Subject: Re: bug#71679: 29.3; treesit-node-child function chokes and crashes emacs for nodes with large number of child nodes
From: Eli Zaretskii <[email-masked]>
To: Mauritz Stenek <[email-masked]>
Cc: [email-masked]
Date: Fri, 21 Jun 2024 09:04:41 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Mauritz Stenek <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 20 Jun 2024 14:23:29 -0600
> 
> 
> > Actually, forget it.  I've succeeded in reproducing this here, 
> > and I
> > see that this problem was already fixed in the development 
> > sources.
> > The next Emacs release will have the bug fixed.
> 
> I'm curious to know, where can I see this fix? is there a 
> commit/patch?

I think it's these two:

  commit 00360258caddc0d8cf29ba3d9971125a06f8959b
  Author:     Yuan Fu <[email-masked]>
  AuthorDate: Sat Jun 1 10:33:18 2024 -0700
  Commit:     Yuan Fu <[email-masked]>
  CommitDate: Sat Jun 1 10:33:18 2024 -0700

      Fix treesit-parse-string crash (bug#71012)

      Parsing a large file with treesit-parse-string and then printing the
      returned node crashes Emacs, because with-temp-buffer kills the temp
      buffer when treesit-parse-string returns, and print.c tries to access
      the node's position in the killed buffer.

      * lisp/treesit.el (treesit-parse-string): Don't use with-temp-buffer.

  commit 20af58d3a13ddb5c2ca376da8cdd3fde4833ca2d
  Author:     Yuan Fu <[email-masked]>
  AuthorDate: Sat Jun 1 10:20:48 2024 -0700
  Commit:     Yuan Fu <[email-masked]>
  CommitDate: Sat Jun 1 10:29:55 2024 -0700

      Check for buffer liveness when accessing tree-sitter node (bug#71012)

      * src/treesit.h (treesit_node_buffer_live_p): Declare function.
      * src/print.c (print_vectorlike): Print node without position if
      buffer is killed.
      * src/treesit.c (treesit_node_buffer_live_p): New function.
      (treesit_check_node): Add buffer liveness check.
      (syms_of_treesit): New error treesit-node-buffer-killed.

> Also, is there a schedule for the next release?

Answered that already in my other mail.

And with that, I'm closing this bug.