Subject: bug#73256: 30.0.91; html-ts-mode crashes Emacs

From: Eli Zaretskii <[email-masked]>
Date: Sun, 15 Sep 2024 08:42:11 +0300

> Cc: Mickey Petersen <[email-masked]>, [email-masked]
> From: Yuan Fu <[email-masked]>
> Date: Sat, 14 Sep 2024 21:02:59 -0700
> 
> 
> 
> > On Sep 14, 2024, at 12:08 PM, Damien Cassou <[email-masked]> wrote:
> > 
> > 
> > I can reproducibly crash Emacs with html-ts-mode:
> > 
> > 1. Save the attached file to your disk
> > 
> > 2. Build libtree-sitter-html.so 0.22.6 if you haven't already
> > 
> > 2. emacs -Q --eval "(setq treesit-extra-load-path '(\"…location-of-libtree-sitter-files/\"))" -l /…/crash-html-ts-mode.el 
> > 
> > 3. Type a letter or two, press backspace to get rid of them
> > 
> > 4. Repeat step 3 once or twice
> > 
> > Fatal error 11: Segmentation fault
> > Backtrace:
> > /…emacs-unstable-30.0.91/bin/emacs[0x57cc28]
> > /…-glibc-2.39-52/lib/libc.so.6(+0x405c0)[0x7f992da495c0]
> > /…-glibc-2.39-52/lib/libc.so.6(__libc_free+0x1e)[0x7f992daaa8be]
> > /…-emacs-packages-deps/lib/libtree-sitter-html.so(tree_sitter_html_externa02]
> > /…-tree-sitter-0.22.6/lib/libtree-sitter.so.0(ts_parser_reset+0x164)[0x7f9/…-tree-sitter-0.22.6/lib/libtree-sitter.so.0(ts_parser_parse+0x112f)[0x7f/…emacs-unstable-30.0.91/bin/emacs[0x67e4e9]
> > /…emacs-unstable-30.0.91/lib/emacs/30.0.91/native-lisp/30.0.91-be7dc7d2/t657369742d2d7072652d7265646973706c6179_treesit__pre_redisplay_0+0x74)[0x7f9917f83494]
> 
> Hmm, that’s a new one. Might be a double-free or something. I’ll look into it ASAP. Thanks for the report!

FWIW, I cannot reproduce the crash here.  It could be something
related to Tree-sitter version (mine is 0.22.8) or version of the HTML
grammar (mine was updated on Sep 8).