all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Morgan Willcock <morgan@ice9.digital>, Yuan Fu <casouri@gmail.com>
Cc: v.pupillo@gmail.com, 73870@debbugs.gnu.org
Subject: bug#73870: 30.0.91; Segmentation fault when enabling php-ts-mode in an empty buffer
Date: Sat, 19 Oct 2024 09:31:04 +0300	[thread overview]
Message-ID: <86iktomwnr.fsf@gnu.org> (raw)
In-Reply-To: <87r08dxh9l.fsf@ice9.digital> (message from Morgan Willcock on Fri, 18 Oct 2024 21:55:50 +0100)

> Cc: v.pupillo@gmail.com
> From: Morgan Willcock <morgan@ice9.digital>
> Date: Fri, 18 Oct 2024 21:55:50 +0100
> 
> 
> 
> I have a reproducible segfault when enabling php-ts-mode (grammars have
> been installed with php-ts-mode-install-parsers):
> 
>   emacs -Q \
>         --eval "(find-file \"/tmp/newfile\")" \
>         --eval "(php-ts-mode)"
> 
> The error doesn't occur when the buffer is not empty, so this doesn't
> crash:
> 
>   emacs -Q \
>         --eval "(find-file \"/tmp/newfile\")" \
>         --eval "(insert \"a\")" \
>         --eval "(php-ts-mode)"
> 
> Here is a backtrace:
> 
>   (gdb) run
>   Starting program: /home/mwillcock/build/emacs-30.0.91/src/emacs -Q --eval \(find-file\ \"/tmp/newfile\"\) --eval \(php-ts-mode\)
>   [Thread debugging using libthread_db enabled]
>   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>   [New Thread 0x7ffff1a476c0 (LWP 70615)]
>   [New Thread 0x7ffff12466c0 (LWP 70616)]
>   [New Thread 0x7ffff0a456c0 (LWP 70617)]
> 
>   Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
>   0x00005555558ee950 in treesit_sync_visible_region (parser=...) at treesit.c:1087
>   1087	      new_ranges[new_len - 1].end_byte = new_end;
>   (gdb) bt full
>   #0  0x00005555558ee950 in treesit_sync_visible_region (parser=...) at treesit.c:1087
>           new_ranges = 0x555556b02e10
>           tree = 0x555556b03ab0
>           buffer = 0x555556109100
>           visible_beg = 1
>           visible_end = 1
>           len = 1
>           ranges = 0x5555568d73a0
>           new_len = 0
>           new_end = 0
>   #1  0x00005555558eed56 in treesit_ensure_parsed (parser=...) at treesit.c:1156
>           buffer = 0x555556109100
>           treesit_parser = 0x0
>           tree = 0x5555558edc7b <treesit_check_parser+36>
>           input = {payload = 0x7fffffffa420, read = 0x5555558ec9b7 <XTS_PARSER+35>, encoding = TSInputEncodingUTF8}
>           new_tree = 0x7fffffffa440

The implementation of that function was significantly modified on the
emacs-30 release branch, so the code which segfaults for you is no
longer there.  Can you try the current emacs-30 branch and see if the
problem still happens there?  If it does, please show a backtrace from
that version.

Thanks.

P.S. Adding Yuan, in case he has some comments.





  reply	other threads:[~2024-10-19  6:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 20:55 bug#73870: 30.0.91; Segmentation fault when enabling php-ts-mode in an empty buffer Morgan Willcock
2024-10-19  6:31 ` Eli Zaretskii [this message]
2024-10-19  9:33   ` Morgan Willcock
2024-10-19 10:14     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=86iktomwnr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73870@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=morgan@ice9.digital \
    --cc=v.pupillo@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.