GNU bug report logs - #22146
Stack overflow in reftex-parse-all

Previous Next

Package: auctex;

Reported by: Nils Kanning <nils <at> kanning.de>

Date: Fri, 11 Dec 2015 21:19:02 UTC

Severity: normal

Done: Tassilo Horn <tsdh <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Tassilo Horn <tsdh <at> gnu.org>
To: David Kastrup <dak <at> gnu.org>
Cc: Nils Kanning <nils <at> kanning.de>, 22146 <at> debbugs.gnu.org,
 Mosè Giordano <mose <at> gnu.org>
Subject: Re: bug#22146: Stack overflow in reftex-parse-all
Date: Sun, 13 Dec 2015 17:55:27 +0100
David Kastrup <dak <at> gnu.org> writes:

>>     (re-search-forward "\\[[^]]*\\<label")
>>
>> at the beginning of the buffer suggested by Nils.  So, it doesn't
>> seem there is an incomplete match, but simply "\\[[^]]*" is too
>> greedy.
>
> This expression contains only a single explicit wildcard.  A stack
> overflow for it most certainly is a bug.  Is this really fixed in 25.1
> or is there just a larger stack?

I also get a stack overflow with this starting with a buffer size of
about 800 lines.  But I can run

  (re-search-forward reftex-everything-regexp nil t)

without problems even after adding 100.000 more "foo foo foo..." lines
to the test file...

Ah, `reftex-everything-regexp' doesn't include that problematic regex
anymore.
Now it contains "\\[[^[]]*\\<label"
instead of      "\\[[^]]*\\<label".

Well, that new regexp has not this problem because it is wrong and
doesn't match keyval style labels anymore.  That problem has been
introduced by:

--8<---------------cut here---------------start------------->8---
commit 32a488344057f210b51f4618feb3a85799eef0c5
Author: Nils Ackermann <nils <at> ackermath.info>
Date:   Tue Jun 16 09:24:47 2015 +0200

    Improve reftex-label-regexps default value
    
    * lisp/textmodes/reftex-vars.el (reftex-label-regexps): Make
    keyvals label regexp more strict to better cope with unbalanced
    brackets common in math documents.
--8<---------------cut here---------------end--------------->8---

I just now changed the regexp (`reftex-label-regexps') to

  "\\[[^][]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?"

(the stuff after \\<label has been there before, too) which works again
in the sense it matches keyval style labels but unfortunately also
causes the stack overflow.

Bye,
Tassilo




This bug report was last modified 9 years and 163 days ago.

Previous Next


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