unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dominique Quatravaux <dominique@quatravaux.org>
To: 68954@debbugs.gnu.org
Subject: bug#68954: [PATCH] Crasher in treesit_traverse_get_predicate
Date: Tue, 6 Feb 2024 18:08:18 +0100	[thread overview]
Message-ID: <CA+tDuRwHPkV1qnBV_8ZKmsNRwjNJsfpq=nK=-4sS9tzqL6q_ZA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 370 bytes --]

Because nothing guarantees or enforces that either Vtreesit_thing_settings,
or the cdrs of its elements, are cons cells, it is easy to construct values
for `treesit-thing-settings' that make Emacs crash (e.g., when calling
`prog-fill-reindent-defun' from any tree-sitter enabled mode).

The attached patch fixes that.

--
 Dominique Quatravaux
 dominique@quatravaux.org

[-- Attachment #1.2: Type: text/html, Size: 596 bytes --]

[-- Attachment #2: treesit.diff --]
[-- Type: application/octet-stream, Size: 618 bytes --]

--- treesit.c.orig	2024-02-06 18:01:23
+++ treesit.c	2024-02-06 18:01:41
@@ -3268,11 +3268,11 @@
 static Lisp_Object
 treesit_traverse_get_predicate (Lisp_Object thing, Lisp_Object language)
 {
-  Lisp_Object cons = assq_no_quit (language, Vtreesit_thing_settings);
+  Lisp_Object cons = assq_no_signal (language, Vtreesit_thing_settings);
   if (NILP (cons))
     return Qnil;
   Lisp_Object definitions = XCDR (cons);
-  Lisp_Object entry = assq_no_quit (thing, definitions);
+  Lisp_Object entry = assq_no_signal (thing, definitions);
   if (NILP (entry))
     return Qnil;
   /* ENTRY looks like (THING PRED).  */

             reply	other threads:[~2024-02-06 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 17:08 Dominique Quatravaux [this message]
2024-02-06 17:15 ` bug#68954: Offending commit Dominique Quatravaux
2024-02-07  1:58   ` Yuan Fu
2024-02-07  7:24     ` Dominique Quatravaux
2024-02-08  1:35       ` Yuan Fu
2024-02-08  9:36         ` Dominique Quatravaux
2024-02-09  5:27           ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+tDuRwHPkV1qnBV_8ZKmsNRwjNJsfpq=nK=-4sS9tzqL6q_ZA@mail.gmail.com' \
    --to=dominique@quatravaux.org \
    --cc=68954@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).