Subject: Re: bug#22146: Stack overflow in reftex-parse-all
From: Tassilo Horn <[email-masked]>
To: David Kastrup <[email-masked]>
Cc: Nils Kanning <[email-masked]>, [email-masked],Mosè Giordano <[email-masked]>
Date: Sun, 13 Dec 2015 19:55:22 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

David Kastrup <[email-masked]> writes:

>> Isn't the syntax "\\[[^]]\\{0,1000\\}\\<label"?  I tried going up to
>> a maximum of 30000 and it still didn't overflow, so I think that's an
>> appropriate fix (say, maybe 2000 instead of 1000 to be extra safe).
>> Feel free to change `reftex-label-regexps' accordingly.
>>
>> Interestingly, "x\\{0,40000\\}" gives an error:
>>
>>   (invalid-regexp "Invalid content of \\{\\}")
>>
>> So there seems to be a (pretty random) limit...
>
> I'd guess that the regexp library translates this into a "short", so
> the limit would be SHORT_MAX, namely 32767.

(re-search-forward "x\\{0,32767\\}") => works
(re-search-forward "x\\{0,32768\\}") => error

Yup, of course you're right.

Anyway, I'm closing this bug with the recent emacs/reftex commit which
looks at a label=... at most 2000 chars after the opening [.

Bye,
Tassilo