GNU bug report logs -
#67977
30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer
Previous Next
Reported by: Denis Zubarev <dvzubarev <at> yandex.ru>
Date: Fri, 22 Dec 2023 23:19:02 UTC
Severity: normal
Found in version 30.0.50
Fixed in version 30.1
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #62 received at 67977 <at> debbugs.gnu.org (full text, mbox):
On 31/12/2023 12:39, Denis Zubarev wrote:
> Also there were errors when running benchmark in the narrowed buffer:
> Error muted by safe_call: (internal--syntax-propertize 1482) signaled
> (args-out-of-range 1 1872)
That does look like a bug.
The patch below seems to fix it:
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 264b95dc3a3..46ebadcf057 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1150,7 +1150,7 @@ treesit--pre-syntax-ppss
(if (and new-start (< new-start start))
(progn
(setq treesit--syntax-propertize-start nil)
- (cons new-start end))
+ (cons (max new-start (point-min)) end))
nil)))
;;; Indent
Or maybe syntax-propertize itself should have a protection against going
outside of bounds:
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index e35992298a6..61a9e79b59c 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -431,7 +431,7 @@ syntax-propertize
(if (or (null new)
(and (>= (car new) start) (<= (cdr new)
end)))
nil
- (setq start (car new))
+ (setq start (max (car new) (point-min)))
(setq end (cdr new))
;; If there's been a change, we should go
through the
;; list again since this new position may
This bug report was last modified 1 year and 44 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.