unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68954: [PATCH] Crasher in treesit_traverse_get_predicate
@ 2024-02-06 17:08 Dominique Quatravaux
  2024-02-06 17:15 ` bug#68954: Offending commit Dominique Quatravaux
  0 siblings, 1 reply; 7+ messages in thread
From: Dominique Quatravaux @ 2024-02-06 17:08 UTC (permalink / raw)
  To: 68954


[-- 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).  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-09  5:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 17:08 bug#68954: [PATCH] Crasher in treesit_traverse_get_predicate Dominique Quatravaux
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

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).