From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 60054@debbugs.gnu.org
Subject: bug#60054: 29.0.60; Infinite loop when there are cyclic path in the parse tree
Date: Sat, 17 Dec 2022 15:28:01 -0800 [thread overview]
Message-ID: <23FFD6B5-D97E-4BEC-9027-EF47EBE89BD6@gmail.com> (raw)
In-Reply-To: <0998189C-4A9E-4B27-A8A0-D208D11E9A39@gmail.com>
Yuan Fu <casouri@gmail.com> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Yuan Fu <casouri@gmail.com>
>>> Date: Wed, 14 Dec 2022 12:27:58 -0800
>>> Cc: 60054@debbugs.gnu.org
>>>
>>> >> https://github.com/tree-sitter/tree-sitter-c/issues/119
>>> >>
>>> >> So far, I’ve only observed this in that specific edge case.
>>> >
>>> > We should have protection against that, which should be easy, right?
>>>
>>> Just to make sure, we want to use something like slow-fast pointers,
>>> where we have two pointers, and one goes twice as fast, right?
>>> That’s the one I was taught in school :-)
>>
>> No, I mean protect us from inflooping by checking that the parent of a
>> node is not the node itself.
>
> In this particular case, it is the siblings’ parent that equals to the
> node. Ie, node->sibling->parent = node. If your intention is to protect
> us from this particular case, switching to use cursors will avoid this
> bug.
Ok, I made the change to use cursor API with tests. Hopefully this is
the last time we need to change treesit.c before release. The
node->sibling->parent = node cyclic path should be fixed by this change,
do you still want checks for it?
Yuan
next prev parent reply other threads:[~2022-12-17 23:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 0:11 bug#60054: 29.0.60; Infinite loop when there are cyclic path in the parse tree Yuan Fu
2022-12-14 12:08 ` Eli Zaretskii
2022-12-14 20:27 ` Yuan Fu
2022-12-15 6:16 ` Eli Zaretskii
2022-12-16 1:14 ` Yuan Fu
2022-12-17 23:28 ` Yuan Fu [this message]
2022-12-18 6:00 ` Eli Zaretskii
2022-12-18 8:10 ` Yuan Fu
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23FFD6B5-D97E-4BEC-9027-EF47EBE89BD6@gmail.com \
--to=casouri@gmail.com \
--cc=60054@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).