GNU bug report logs - #72238
31.0.50; Segfault after treesit_delete_query

Previous Next

Package: emacs;

Reported by: Noah Peart <noah.v.peart <at> gmail.com>

Date: Sun, 21 Jul 2024 21:45:01 UTC

Severity: normal

Found in version 31.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 72238 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Noah Peart <noah.v.peart <at> gmail.com>, john muhl <jm <at> pub.pink>,
 72238 <at> debbugs.gnu.org
Subject: Re: bug#72238: 31.0.50; Segfault after treesit_delete_query
Date: Tue, 23 Jul 2024 09:44:56 -0700

> On Jul 22, 2024, at 4:17 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Cc: Noah Peart <noah.v.peart <at> gmail.com>, 72238 <at> debbugs.gnu.org
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sun, 21 Jul 2024 17:01:31 -0700
>> 
>> 
>> 
>>> On Jul 21, 2024, at 3:24 PM, john muhl <jm <at> pub.pink> wrote:
>>> 
>>> Noah Peart <noah.v.peart <at> gmail.com> writes:
>>> 
>>>> After recent build, emacs is crashing frequently when using tree-sitter
>>>> modes.
>>>> 
>>>> The following backtrace was generated after opening a few C files,
>>>> enabling c-ts-mode, and moving the cursor around a bit. I dont have
>>>> precise steps for repeatability at this point (sorry!), as it seems to
>>>> occur during garbage collection.
>>>> 
>>>> Let me know if there is more useful output I could provide.
>>> 
>>> Could you try reverting 1abf3bdd7ed and see if that helps?
>> 
>> Hey guys, sorry for the segfault. It’s indeed caused by 1abf3bdd7ed, I just fixed it on master. 
> 
> Thanks, but I'm confused, since I see a fix both on emacs-30 and on
> master.  What exactly did you fix and on which branch(es)?  Did the
> problem exist on emacs-30 (it was reported for master)?

Yeah, there’re two bugs: 1) we shouldn’t delete the query object without checking for NULL, and 2) we shouldn’t delete the cursor object without checking for NULL. In emacs-30, only query could be NULL, cursor is always initialized; in emacs-master, due to my recent change, both query and cursor could be NULL.

So I added checks for both query and cursor in one commit and pushed to master, and cherry-picked the commit to emacs-30. 

Yuan



This bug report was last modified 326 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.