From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 11 16:18:12 2015 Received: (at submit) by debbugs.gnu.org; 11 Dec 2015 21:18:12 +0000 Received: from localhost ([127.0.0.1]:35133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7V4u-0005XF-Ek for submit@debbugs.gnu.org; Fri, 11 Dec 2015 16:18:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58587) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7Uqo-0005Bp-Ab for submit@debbugs.gnu.org; Fri, 11 Dec 2015 16:03:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7Uqi-0001zm-HJ for submit@debbugs.gnu.org; Fri, 11 Dec 2015 16:03:33 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7Uqi-0001ze-Eq for submit@debbugs.gnu.org; Fri, 11 Dec 2015 16:03:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7Uqh-0000uu-Mr for bug-auctex@gnu.org; Fri, 11 Dec 2015 16:03:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7Uqe-0001yb-IN for bug-auctex@gnu.org; Fri, 11 Dec 2015 16:03:31 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:52399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7Uqe-0001yF-9L for bug-auctex@gnu.org; Fri, 11 Dec 2015 16:03:28 -0500 Received: from x220tablet ([77.13.182.6]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0Lsw94-1aDhyB2SMs-012b6L for ; Fri, 11 Dec 2015 22:03:25 +0100 Message-ID: <1449867804.3214.18.camel@kanning.de> Subject: Stack overflow in reftex-parse-all From: Nils Kanning To: bug-auctex@gnu.org Date: Fri, 11 Dec 2015 22:03:24 +0100 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:rmrjcHz0KReVEom+nzWsvVNKrDkXeY6ZP9L2cencqIHW5EmLIJD BQPzMr3BnKetz8xXQnI4+i84LvK/34uPfNofynmpZObePH7M3E7rOi51bhDfzNz4R1hfcj/ NWXHzMbqq/Q9KNuZmIAZhzYg49r5vzjZEWDDGKqwdbL/ekCLyR5wSZzYfMCRP5RdvY+9ETr DR8cr3N9Z0jHWEdZ8lQRQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:L51T9XSVZJk=:Jpkwo5k2ca5hnODsqkVnJO UFMx+c3FVdPfb5NTSq3xQRlYhmEc0KOkkK0YqXS4aQIL7m+a7Sn0t4oZKoLqxAHZu7zY8L/sv h4tjk9t5kz75X8XwkdVjE3MMPro+B0nEwVmMm74+dF6fUdpCYRd8VUfCU8l8ZUvMIixB1oVQj Q/rXZ+TwqUQ2D9ztqmf3YmLdlC9Ui5HNMKaaZ7QCx4gWeiNYByM/Vr3ZiatnYyUcL8muSLuB+ yX/fT+H1nA+z7JmdLbQtNhhbpv3Rg3UmVTO6y54JJaReEBY28BstMjU6RJkCeNQ4+NpS4+uQ/ bFjqae5mv+Xrnr2l7pzLW+zim1irxRRMuN3urSY1odQby19P3bjjffSkGF5iShr7UhCVQphiP 2m8vpxOMHpFO1sJ3Bpe9vO9CE4t1Q8iL6iKYo28Vqo6YFypV98IAOceLCdy3fGnRBulGa43A+ 6/sBbPtxvJIAxCHdTUDv8jRTG/wtG+nB+PL13T35X6YrX1aMO/nrlW66gymN5qgrzzJxgBSps tUkeTOxj4a/F16fnaN9fF1iAxDRTuCgfYx8Bal53Fp0Bitm+p1KioCydegQMkmky8M/5o2Oxd rVZO0O5fPxBdJJ4jovmc9hljUxkDykoBNadlAcM+VLGsc2LmqQZKv+ZyHLRL9iGTkgONlhwqI N3rNW4rz2NAIhNHpSBnHRW1qQX4zG/gq2JrbmDjU5XTBq2zn5E7MtJ7qt6PAULQKc8jQ/hgJ3 yslXjUzFqmBB3pbV X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 11 Dec 2015 16:18:11 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Dear all, I encounter the error "Stack overflow in regexp matcher" if I apply the function reftex-parse-all to the following file: \documentclass{article} \begin{document} [\} foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo ... foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo \end{document} Here ... stands for 500 copies of the line above. The file can be compiled successfully with pdflatex. I am using the Debian packages emacs24 24.5+1-3 and auctex 11.88-1.1. The same error also occurs with different versions. In case you are wondering, the non-matching brackets [\} appear for example in physics as so-called "super Lie brackets". Best Nils From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 11 18:37:44 2015 Received: (at 22146) by debbugs.gnu.org; 11 Dec 2015 23:37:44 +0000 Received: from localhost ([127.0.0.1]:35185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7XFw-0000MH-13 for submit@debbugs.gnu.org; Fri, 11 Dec 2015 18:37:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56633) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7XFu-0000M4-WE for 22146@debbugs.gnu.org; Fri, 11 Dec 2015 18:37:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7XFm-0003qE-KR for 22146@debbugs.gnu.org; Fri, 11 Dec 2015 18:37:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7XFm-0003q5-HR for 22146@debbugs.gnu.org; Fri, 11 Dec 2015 18:37:34 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:34838) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.82) (envelope-from ) id 1a7XFl-00071V-Um for 22146@debbugs.gnu.org; Fri, 11 Dec 2015 18:37:34 -0500 Received: by mail-wm0-f47.google.com with SMTP id l68so35135295wml.0 for <22146@debbugs.gnu.org>; Fri, 11 Dec 2015 15:37:33 -0800 (PST) X-Received: by 10.28.182.11 with SMTP id g11mr9582624wmf.42.1449877052778; Fri, 11 Dec 2015 15:37:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.152.72 with HTTP; Fri, 11 Dec 2015 15:36:53 -0800 (PST) In-Reply-To: <1449867804.3214.18.camel@kanning.de> References: <1449867804.3214.18.camel@kanning.de> From: =?UTF-8?Q?Mos=C3=A8_Giordano?= Date: Sat, 12 Dec 2015 00:36:53 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#22146: Stack overflow in reftex-parse-all To: Nils Kanning Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: 22146@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi Nils, 2015-12-11 22:03 GMT+01:00 Nils Kanning : > Dear all, > > I encounter the error "Stack overflow in regexp matcher" if I apply the > function reftex-parse-all to the following file: > > \documentclass{article} > \begin{document} > [\} > foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo > ... > foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo > \end{document} > > Here ... stands for 500 copies of the line above. The file can be > compiled successfully with pdflatex. > > I am using the Debian packages emacs24 24.5+1-3 and auctex 11.88-1.1. > The same error also occurs with different versions. We've recently released AUCTeX 11.89, you can grab it from ELPA ;-) > In case you are wondering, the non-matching brackets [\} appear for > example in physics as so-called "super Lie brackets". Thanks for taking the time to report this bug, I can reproduce it. The culprit is the (re-search-forward (reftex-everything-regexp) nil t) within the `reftex-with-special-syntax' macro in `reftex-parse-from-file' function. Actually in the code it is called as (re-search-forward regexp nil t) I wrote the above line for ease of reproduction. Of course `reftex-everything-regexp' is an undocumented function that returns one of two undocumented variables. I can reproduce the bug only if `reftex-support-index' is non-nil, so in the end the culprit is `reftex-everything-regexp'. There is a simple workaround you can put in your code: close the brackets, also in a comment is fine: [\} % ] But I don't know how to really fix the bug, it's too late for me to decrypt that regexp now. Having a clue of what it should *exactly* match would be of great help. Bye, Mos=C3=A8 From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 12 02:54:51 2015 Received: (at 22146) by debbugs.gnu.org; 12 Dec 2015 07:54:51 +0000 Received: from localhost ([127.0.0.1]:35373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7f11-00058J-Bi for submit@debbugs.gnu.org; Sat, 12 Dec 2015 02:54:51 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34119) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7f10-00058A-0b for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 02:54:50 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B598E20919 for <22146@debbugs.gnu.org>; Sat, 12 Dec 2015 02:54:49 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Sat, 12 Dec 2015 02:54:49 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=81y2A2Y4eclhPe0 wAs/s5OLGM9A=; b=mmE2ssYCJERkXWKbNl//GUG++DJAtiJMlzDUuRy28z54ndx uhu8DfeS7txdIYpekj8Y2dqzEkXLEoLe+7UU4a6rhkdBCwg1E7K55NHBG4u9aQrP HYFuEDRDtiFBhfwPBKzRPK9DUQNbPHKysfk3eZRGkSwC3H4e6EKSeK9A2yWI= X-Sasl-enc: vASXIfzuUfHXy1wxqgGiXaYX5cu4pUxHFbW6dkq3NXuR 1449906889 Received: from thinkpad-t440p (unknown [2.161.244.137]) by mail.messagingengine.com (Postfix) with ESMTPA id C52A2680167; Sat, 12 Dec 2015 02:54:47 -0500 (EST) From: Tassilo Horn To: =?utf-8?Q?Mos=C3=A8?= Giordano Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> Date: Sat, 12 Dec 2015 08:54:44 +0100 In-Reply-To: (=?utf-8?Q?=22Mos=C3=A8?= Giordano"'s message of "Sat, 12 Dec 2015 00:36:53 +0100") Message-ID: <87a8pg9k57.fsf@gnu.org> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Mos=C3=A8 Giordano writes: Hi Nils & Mos=C3=A9, >> In case you are wondering, the non-matching brackets [\} appear for >> example in physics as so-called "super Lie brackets". > > Thanks for taking the time to report this bug, I can reproduce it. I can reproduce it with Emacs 24.5 but not with Emacs 25.0.50.16 from the current emacs-25 branch. So maybe it has been fixed after the last release (either the regex, or the Emacs regex matcher has become better). If anyone of you could try with Emacs 25 and report back, that'd be great. > There is a simple workaround you can put in your code: close the > brackets, also in a comment is fine: > > [\} % ] > > But I don't know how to really fix the bug, it's too late for me to > decrypt that regexp now. Having a clue of what it should *exactly* > match would be of great help. Obviously, it should match everything that's interesting to reftex. :-) But seriously, have a look at the bottom of `reftex-compile-variables' where `reftex-everything-regexp' is composed from several other regexes with more local scopes, e.g., one for matching labels, one for sections, one for index entries, etc. Bye, Tassilo From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 12 04:13:21 2015 Received: (at 22146) by debbugs.gnu.org; 12 Dec 2015 09:13:21 +0000 Received: from localhost ([127.0.0.1]:35389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7gEz-0006rQ-NC for submit@debbugs.gnu.org; Sat, 12 Dec 2015 04:13:21 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:59258) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7gEy-0006rF-4z for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 04:13:20 -0500 Received: from x220tablet ([77.13.188.243]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0Lw14n-1aJHjY48rd-017iW0; Sat, 12 Dec 2015 10:13:14 +0100 Message-ID: <1449911593.3214.21.camel@kanning.de> Subject: Re: bug#22146: Stack overflow in reftex-parse-all From: Nils Kanning To: Tassilo Horn , =?ISO-8859-1?Q?Mos=E8?= Giordano Date: Sat, 12 Dec 2015 10:13:13 +0100 In-Reply-To: <87a8pg9k57.fsf@gnu.org> References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:7rFB7SHs4cEFG8sT51mfvq35fugxG8j1q+THQwFVDV45r3Wl0sI onaOIrexHABRO8WYJVVBZ8FNCDuLIL+4jZGiI58lHmNpMDz1IGsidcxtjMWGaJpLCD0yhzh +FWBJ1TNMiPYAT9EEXlPkg4fZvPr51q6qbUr87zh3V+M/22cvtFtaV1eyS2uJkVQ83XmqNx rhPDJgNhnljyZ0db7UvTA== X-UI-Out-Filterresults: notjunk:1;V01:K0:FnOtcoah1Jk=:yIieh1RzuXOYt4DBONyq45 fwkhj9uUmZJkvTveWZ9i0Jz60H+8JL5xqLtCuy6SEKmGGp42aKrma9CZS6QDO/9GA/+MDQ79O +MzcKESWHsPwHuruMYHNsduwgHTlNQ5c2Xb4UZ7ozqgdc3QqLHjaJzmjEAXwLWjUf847+SZ1R N1zkkBTgwsmj1GjAGcHNko/388+ghYgmvN1jRZ/Thheh6K1r2R3Cs4xovnQYvbbxyWY/sKDSB k2vTX0UYXfq5c3VHehzR1YSIKxa5jvbDQC1MdsysNhv5fJQ1xvYLdWHcu2vPpDf0u+OKz5AEf 4whpZrGDT9nLjycGdWyuwYFMIlvXyZm9aM89FA8PdUL+bMyKEkbfegPqb0BZcYF1LJW3FnP0h HVE62/SDnWL7lLAN/GZrH4GUmoMzPlIwe01XWgRUjxwD9liEAwpKIeKYjJPyoZ9U0/ZA4Kbo1 Rjm/iIvbYBqeQcPW9tdkAlwKLmOOBLlTehZdw3uLKagYMqAb7iP5A+94SrKJ8jQMIhnnGV7GD PBjzaSU8ur/UjdAjW/ZARH6kTPMOqFDfj0ZDpeErxX+GV4tNdArUpgTfX5iVgrPjhoGy7xnOk fue37TslieBpvNkII2eAXxGANURceBEtAbXYXZjf/cQzbeKMk7nky/WyDAqQWQBloeWY2PuKk 1ZHUrYDThq4ZzSFHKClm2ctXroVnnhE7etNwdVGVbvXhgtPmEIjpZdAymLid6uCGwIFr7u1my x2/xp37TJEI+Uu/L X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22146 Cc: 22146@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hi=C2=A0Mos=C3=A9 and=C2=A0Tassilo, thanks a lot for your quick replies! With that workaround I can continue editing :-) Nils On Sat, 2015-12-12 at 08:54 +0100, Tassilo Horn wrote: > Mos=C3=A8 Giordano writes: >=20 > Hi Nils & Mos=C3=A9, >=20 > > > In case you are wondering, the non-matching brackets [\} appear > > > for > > > example in physics as so-called "super Lie brackets". > >=20 > > Thanks for taking the time to report this bug, I can reproduce it. >=20 > I can reproduce it with Emacs 24.5 but not with Emacs 25.0.50.16 from > the current emacs-25 branch.=C2=A0=C2=A0So maybe it has been fixed after = the > last > release (either the regex, or the Emacs regex matcher has become > better). >=20 > If anyone of you could try with Emacs 25 and report back, that'd be > great. >=20 > > There is a simple workaround you can put in your code: close the > > brackets, also in a comment is fine: > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0[\} % ] > >=20 > > But I don't know how to really fix the bug, it's too late for me to > > decrypt that regexp now.=C2=A0=C2=A0Having a clue of what it should *ex= actly* > > match would be of great help. >=20 > Obviously, it should match everything that's interesting to reftex. > :-) >=20 > But seriously, have a look at the bottom of `reftex-compile- > variables' > where `reftex-everything-regexp' is composed from several other > regexes > with more local scopes, e.g., one for matching labels, one for > sections, > one for index entries, etc. >=20 > Bye, > Tassilo From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 12 04:42:45 2015 Received: (at 22146) by debbugs.gnu.org; 12 Dec 2015 09:42:46 +0000 Received: from localhost ([127.0.0.1]:35408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7ghR-0007ad-NM for submit@debbugs.gnu.org; Sat, 12 Dec 2015 04:42:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60665) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7ghQ-0007aR-4A for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 04:42:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7ghH-00064z-QN for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 04:42:38 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7ghH-00064u-Mx for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 04:42:35 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:38222) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.82) (envelope-from ) id 1a7ghG-0003D3-Sk for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 04:42:35 -0500 Received: by wmpp66 with SMTP id p66so2420393wmp.1 for <22146@debbugs.gnu.org>; Sat, 12 Dec 2015 01:42:33 -0800 (PST) X-Received: by 10.28.182.11 with SMTP id g11mr12284110wmf.42.1449913353791; Sat, 12 Dec 2015 01:42:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.152.72 with HTTP; Sat, 12 Dec 2015 01:41:54 -0800 (PST) In-Reply-To: <87a8pg9k57.fsf@gnu.org> References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> From: =?UTF-8?Q?Mos=C3=A8_Giordano?= Date: Sat, 12 Dec 2015 10:41:54 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#22146: Stack overflow in reftex-parse-all To: Tassilo Horn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi Tassilo, 2015-12-12 8:54 GMT+01:00 Tassilo Horn : > Mos=C3=A8 Giordano writes: > > Hi Nils & Mos=C3=A9, > >>> In case you are wondering, the non-matching brackets [\} appear for >>> example in physics as so-called "super Lie brackets". >> >> Thanks for taking the time to report this bug, I can reproduce it. > > I can reproduce it with Emacs 24.5 but not with Emacs 25.0.50.16 from > the current emacs-25 branch. So maybe it has been fixed after the last > release (either the regex, or the Emacs regex matcher has become > better). `reftex-compile-variables' hasn't been changed in the last two years, maybe Emacs regexp matcher has been improved. But the error may indicate of a malformed, or too greedy, regexp. > If anyone of you could try with Emacs 25 and report back, that'd be > great. > >> There is a simple workaround you can put in your code: close the >> brackets, also in a comment is fine: >> >> [\} % ] >> >> But I don't know how to really fix the bug, it's too late for me to >> decrypt that regexp now. Having a clue of what it should *exactly* >> match would be of great help. > > Obviously, it should match everything that's interesting to reftex. :-) > > But seriously, have a look at the bottom of `reftex-compile-variables' > where `reftex-everything-regexp' is composed from several other regexes > with more local scopes, e.g., one for matching labels, one for sections, > one for index entries, etc. Yes, I saw it, but it was too late to really study it ;-) I can see there are some labeling and sectioning commands, but there are also many groups matching something less intuitive at a first glance. I'll try to have a more thorough look in the next days. I'm not completely sure how to fix a "Stack overflow in regexp matcher" error: the problem is that it matches nothing or too much? My understanding is the former, but the culprit could be the all those \n\r, that cause the regexp to try and match all the buffer, even if it fails in the end. Bye, Mos=C3=A8 From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 12 05:05:23 2015 Received: (at 22146) by debbugs.gnu.org; 12 Dec 2015 10:05:23 +0000 Received: from localhost ([127.0.0.1]:35417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7h3L-00086C-Jj for submit@debbugs.gnu.org; Sat, 12 Dec 2015 05:05:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35201) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7h3J-000860-NP for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 05:05:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7h3D-0002Jm-NC for 22146@debbugs.gnu.org; Sat, 12 Dec 2015 05:05:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7h3D-0002JU-LG; Sat, 12 Dec 2015 05:05:15 -0500 Received: from localhost ([127.0.0.1]:56705 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.82) (envelope-from ) id 1a7h3B-0004IM-9t; Sat, 12 Dec 2015 05:05:13 -0500 Received: by lola (Postfix, from userid 1000) id D35C6DF969; Sat, 12 Dec 2015 11:05:12 +0100 (CET) From: David Kastrup To: =?iso-8859-1?Q?Mos=E8?= Giordano Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> Date: Sat, 12 Dec 2015 11:05:12 +0100 In-Reply-To: (=?iso-8859-1?Q?=22Mos=E8?= Giordano"'s message of "Sat, 12 Dec 2015 10:41:54 +0100") Message-ID: <871taskmnb.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, Tassilo Horn X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mos=E8 Giordano writes: > I'm not completely sure how to fix a "Stack overflow in regexp > matcher" error: the problem is that it matches nothing or too much? It has incomplete matches in too many different ways. Something like .*.* is a trivial example of stuff that can usually match in too many different ways. A nice regexp is one where each character of an incomplete match is only a candidate for a single component of the regexp. An ugly regexp is one where adding one character to the match grows the possibly match/pattern correspondences by more than one repeatedly. --=20 David Kastrup From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 13 06:54:22 2015 Received: (at 22146) by debbugs.gnu.org; 13 Dec 2015 11:54:22 +0000 Received: from localhost ([127.0.0.1]:49908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a85EM-0006iG-0Q for submit@debbugs.gnu.org; Sun, 13 Dec 2015 06:54:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34222) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a85EK-0006i3-FN for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a85EB-00021L-VE for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 06:54:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a85EB-00021E-SK for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 06:54:11 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36944) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.82) (envelope-from ) id 1a85EB-0004vN-76 for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 06:54:11 -0500 Received: by wmnn186 with SMTP id n186so86816433wmn.0 for <22146@debbugs.gnu.org>; Sun, 13 Dec 2015 03:54:10 -0800 (PST) X-Received: by 10.28.127.200 with SMTP id a191mr19371809wmd.27.1450007650067; Sun, 13 Dec 2015 03:54:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.152.72 with HTTP; Sun, 13 Dec 2015 03:53:30 -0800 (PST) In-Reply-To: <871taskmnb.fsf@fencepost.gnu.org> References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> From: =?UTF-8?Q?Mos=C3=A8_Giordano?= Date: Sun, 13 Dec 2015 12:53:30 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#22146: Stack overflow in reftex-parse-all To: David Kastrup Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, Tassilo Horn X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi David, 2015-12-12 11:05 GMT+01:00 David Kastrup : > Mos=C3=A8 Giordano writes: > >> I'm not completely sure how to fix a "Stack overflow in regexp >> matcher" error: the problem is that it matches nothing or too much? > > It has incomplete matches in too many different ways. Something like > > .*.* > > is a trivial example of stuff that can usually match in too many > different ways. A nice regexp is one where each character of an > incomplete match is only a candidate for a single component of the > regexp. > > An ugly regexp is one where adding one character to the match grows the > possibly match/pattern correspondences by more than one repeatedly. Thanks for the explanation, but in this concrete case I can reproduce the bug in Emacs 24.5 evaluating (re-search-forward "\\[[^]]*\\) id 1a88Ij-0004Rl-LL for submit@debbugs.gnu.org; Sun, 13 Dec 2015 10:11:05 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35506) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a88Ii-0004RG-SI for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 10:11:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a88Ic-0007YA-Sk for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 10:10:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a88Ic-0007Y4-QP; Sun, 13 Dec 2015 10:10:58 -0500 Received: from localhost ([127.0.0.1]:54004 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.82) (envelope-from ) id 1a88Ib-0006tq-9z; Sun, 13 Dec 2015 10:10:57 -0500 Received: by lola (Postfix, from userid 1000) id 4208EDF994; Sun, 13 Dec 2015 16:09:32 +0100 (CET) From: David Kastrup To: =?iso-8859-1?Q?Mos=E8?= Giordano Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> Date: Sun, 13 Dec 2015 16:09:31 +0100 In-Reply-To: (=?iso-8859-1?Q?=22Mos=E8?= Giordano"'s message of "Sun, 13 Dec 2015 12:53:30 +0100") Message-ID: <87r3iq9yhg.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, Tassilo Horn X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mos=E8 Giordano writes: > > (re-search-forward "\\[[^]]*\\ > 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? Maybe make the test case significantly larger and check that still no stack overflow occurs. --=20 David Kastrup From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 13 11:55:33 2015 Received: (at 22146) by debbugs.gnu.org; 13 Dec 2015 16:55:33 +0000 Received: from localhost ([127.0.0.1]:50324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a89vp-0006vU-9f for submit@debbugs.gnu.org; Sun, 13 Dec 2015 11:55:33 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39654) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a89vn-0006vL-Dg for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 11:55:31 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id E4D2B2072D for <22146@debbugs.gnu.org>; Sun, 13 Dec 2015 11:55:30 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Sun, 13 Dec 2015 11:55:30 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=S4mIlZym3Llrb7bufErfJqKn7t8=; b=BXeoc rLGzEEom8zH562lk4I03wxFuGtNCapwIrRujEfdDls2U6IgAyww9FqlzsEJFew+H fTfSddzLMc25eSnzytl5GIajv7az+o+pwmbCQ/Q7lKCTy7A3fCJfSaWfiflBmmH0 roJCTSB05WWH3hsypRDLtTlWMYH8K1Bu0ElBUg= X-Sasl-enc: fJjbhXFWHY0Ov0qHbrb57AS+DfnC05tq5j0GgAW9SEK1 1450025730 Received: from thinkpad-t440p (unknown [2.160.198.191]) by mail.messagingengine.com (Postfix) with ESMTPA id D985CC016C4; Sun, 13 Dec 2015 11:55:29 -0500 (EST) From: Tassilo Horn To: David Kastrup Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> Date: Sun, 13 Dec 2015 17:55:27 +0100 In-Reply-To: <87r3iq9yhg.fsf@fencepost.gnu.org> (David Kastrup's message of "Sun, 13 Dec 2015 16:09:31 +0100") Message-ID: <87y4cynv9c.fsf@gnu.org> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, =?utf-8?Q?Mos=C3=A8?= Giordano X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) David Kastrup writes: >> (re-search-forward "\\[[^]]*\\> >> 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 "\\[[^[]]*\\8--- commit 32a488344057f210b51f4618feb3a85799eef0c5 Author: Nils Ackermann 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 "\\[[^][]*\\) id 1a8AC0-0007Jx-RE for submit@debbugs.gnu.org; Sun, 13 Dec 2015 12:12:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56664) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8ABy-0007Ji-OM for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:12:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8ABo-0008Mx-B2 for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:12:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8ABo-0008Mn-81 for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:12:04 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35675) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.82) (envelope-from ) id 1a8ABn-0006rp-KV for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:12:03 -0500 Received: by mail-wm0-f50.google.com with SMTP id p66so15841096wmp.0 for <22146@debbugs.gnu.org>; Sun, 13 Dec 2015 09:12:03 -0800 (PST) X-Received: by 10.194.250.39 with SMTP id yz7mr36171810wjc.92.1450026722647; Sun, 13 Dec 2015 09:12:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.152.72 with HTTP; Sun, 13 Dec 2015 09:11:23 -0800 (PST) In-Reply-To: <87y4cynv9c.fsf@gnu.org> References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> <87y4cynv9c.fsf@gnu.org> From: =?UTF-8?Q?Mos=C3=A8_Giordano?= Date: Sun, 13 Dec 2015 18:11:23 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#22146: Stack overflow in reftex-parse-all To: Tassilo Horn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, David Kastrup X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi Tassilo, 2015-12-13 17:55 GMT+01:00 Tassilo Horn : > David Kastrup writes: > >>> (re-search-forward "\\[[^]]*\\>> >>> 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... Uh, in Emacs 24.5 (re-search-forward "\\[[^]]*\\) id 1a8AjS-00088M-M1 for submit@debbugs.gnu.org; Sun, 13 Dec 2015 12:46:50 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36910) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8AjQ-00088F-UN for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:46:49 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9337920769 for <22146@debbugs.gnu.org>; Sun, 13 Dec 2015 12:46:48 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Sun, 13 Dec 2015 12:46:48 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=41QkUVKyUzz6geZ BqJ7ef1lmVu8=; b=gEt+5+9f+/xddQanBeebRXnrSMiiav4ZUs0XMgkNO70ChV6 fkeQyXugoZgb13QutCsNnt8iBjSIBpGn1MU70xci9/3F9BDzcWfZMkD6GCDjsNjz uKro5LLKQXEcMN0wZ7FcgE2hFPnsoUj74JL/Rf2Jtpts+zS0CmZ/Hmp1cMyY= X-Sasl-enc: Q7m7mpFqdpDKQzpk08CpRYmR058792v7WHfFeb96DzrC 1450028808 Received: from thinkpad-t440p (unknown [2.160.198.191]) by mail.messagingengine.com (Postfix) with ESMTPA id 8BB1868016F; Sun, 13 Dec 2015 12:46:47 -0500 (EST) From: Tassilo Horn To: =?utf-8?Q?Mos=C3=A8?= Giordano Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> <87y4cynv9c.fsf@gnu.org> Date: Sun, 13 Dec 2015 18:46:45 +0100 In-Reply-To: (=?utf-8?Q?=22Mos=C3=A8?= Giordano"'s message of "Sun, 13 Dec 2015 18:11:23 +0100") Message-ID: <87y4cyw8ai.fsf@gnu.org> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, David Kastrup X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Mos=C3=A8 Giordano writes: >>>> (re-search-forward "\\[[^]]*\\>>> >>>> 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... > > Uh, in Emacs 24.5 > > (re-search-forward "\\[[^]]*\\ > throws the stack overflow error, indeed I tested also this > possibility. So are you saying that in Emacs 25.1 the noerror option > prevents stack overflow? No, in Emacs 25 the regexp was broken in a way that its meaning was not "[ and then many times something different than ]" but "[, then not another [, and then zero or many times a ]". Now that I fixed the regexp again, Emacs 25 breaks in the same way. > Anyway, how about my suggestion to use > > "\\[[^]]\{0,1000\}\\ > ? 1000 characters are 12.5 80-column-wide lines, I think it's large enou= gh. Isn't the syntax "\\[[^]]\\{0,1000\\}\\) id 1a8ApN-0008IB-Qj for submit@debbugs.gnu.org; Sun, 13 Dec 2015 12:52:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35077) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8ApM-0008Hz-Lm for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:52:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8ApG-0008If-KT for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 12:52:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8ApG-0008Ib-H1; Sun, 13 Dec 2015 12:52:50 -0500 Received: from localhost ([127.0.0.1]:55595 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.82) (envelope-from ) id 1a8ApF-00084o-A3; Sun, 13 Dec 2015 12:52:49 -0500 Received: by lola (Postfix, from userid 1000) id BDE03DF99B; Sun, 13 Dec 2015 18:52:48 +0100 (CET) From: David Kastrup To: Tassilo Horn Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> <87y4cynv9c.fsf@gnu.org> <87y4cyw8ai.fsf@gnu.org> Date: Sun, 13 Dec 2015 18:52:48 +0100 In-Reply-To: <87y4cyw8ai.fsf@gnu.org> (Tassilo Horn's message of "Sun, 13 Dec 2015 18:46:45 +0100") Message-ID: <87io429qxb.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, =?iso-8859-1?Q?Mos=E8?= Giordano X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Tassilo Horn writes: > Mos=E8 Giordano writes: > Isn't the syntax "\\[[^]]\\{0,1000\\}\\ 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. --=20 David Kastrup From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 13 13:00:35 2015 Received: (at 22146) by debbugs.gnu.org; 13 Dec 2015 18:00:35 +0000 Received: from localhost ([127.0.0.1]:50413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8Awk-0000hz-QS for submit@debbugs.gnu.org; Sun, 13 Dec 2015 13:00:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36575) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8Awi-0000Yt-Lf for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 13:00:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8Awa-0001k6-Gj for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 13:00:27 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Awa-0001jy-Do for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 13:00:24 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:32905) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.82) (envelope-from ) id 1a8AwZ-0004Ga-DQ for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 13:00:23 -0500 Received: by mail-wm0-f50.google.com with SMTP id n186so17472231wmn.0 for <22146@debbugs.gnu.org>; Sun, 13 Dec 2015 10:00:23 -0800 (PST) X-Received: by 10.28.142.205 with SMTP id q196mr20658160wmd.42.1450029622276; Sun, 13 Dec 2015 10:00:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.152.72 with HTTP; Sun, 13 Dec 2015 09:59:42 -0800 (PST) In-Reply-To: <87y4cyw8ai.fsf@gnu.org> References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> <87y4cynv9c.fsf@gnu.org> <87y4cyw8ai.fsf@gnu.org> From: =?UTF-8?Q?Mos=C3=A8_Giordano?= Date: Sun, 13 Dec 2015 18:59:42 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#22146: Stack overflow in reftex-parse-all To: Tassilo Horn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, David Kastrup X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) 2015-12-13 18:46 GMT+01:00 Tassilo Horn : > Mos=C3=A8 Giordano writes: > >>>>> (re-search-forward "\\[[^]]*\\>>>> >>>>> 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... >> >> Uh, in Emacs 24.5 >> >> (re-search-forward "\\[[^]]*\\> >> throws the stack overflow error, indeed I tested also this >> possibility. So are you saying that in Emacs 25.1 the noerror option >> prevents stack overflow? > > No, in Emacs 25 the regexp was broken in a way that its meaning was not > "[ and then many times something different than ]" but "[, then not > another [, and then zero or many times a ]". Now that I fixed the > regexp again, Emacs 25 breaks in the same way. > >> Anyway, how about my suggestion to use >> >> "\\[[^]]\{0,1000\}\\> >> ? 1000 characters are 12.5 80-column-wide lines, I think it's large eno= ugh. > > Isn't the syntax "\\[[^]]\\{0,1000\\}\\ I tried going up to a > maximum of 30000 and it still didn't overflow, It does for me, from 16667 to be precise. > 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. I don't have write access to Emacs repo :-) Bye, Mos=C3=A8 From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 13 13:48:40 2015 Received: (at 22146) by debbugs.gnu.org; 13 Dec 2015 18:48:40 +0000 Received: from localhost ([127.0.0.1]:50500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8BhI-0004a8-J1 for submit@debbugs.gnu.org; Sun, 13 Dec 2015 13:48:40 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42521) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8BhH-0004a1-GD for 22146@debbugs.gnu.org; Sun, 13 Dec 2015 13:48:39 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EF890200B6 for <22146@debbugs.gnu.org>; Sun, 13 Dec 2015 13:48:38 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Sun, 13 Dec 2015 13:48:38 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=VHEEYSS4pd8h4Xm U/PrNeyAcpso=; b=pr0G2iuoUGoQFq2cv3ti/Qg6CZZ3HZjGQ70pSRSxSQvL7Jm AuTwjyTMk6D+Pcq4ojbs0Er+ps/XXZCl/obaTu9cVuJhurHgxF29UvuuE3SlWzUT kBBuVde2Zh8aBm44tdonZkGBcdnY7ogELAj0a7sTYj1oUUafNvE2FREGtYh8= X-Sasl-enc: wQThhK+Y3+5NRPPyUCEK0+fEGUbNwkcSkMxSGCYutqnk 1450032518 Received: from thinkpad-t440p (unknown [2.160.198.191]) by mail.messagingengine.com (Postfix) with ESMTPA id E549AC016D5; Sun, 13 Dec 2015 13:48:37 -0500 (EST) From: Tassilo Horn To: =?utf-8?Q?Mos=C3=A8?= Giordano Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> <87y4cynv9c.fsf@gnu.org> <87y4cyw8ai.fsf@gnu.org> Date: Sun, 13 Dec 2015 19:48:35 +0100 In-Reply-To: (=?utf-8?Q?=22Mos=C3=A8?= Giordano"'s message of "Sun, 13 Dec 2015 18:59:42 +0100") Message-ID: <87vb8218xo.fsf@gnu.org> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 22146 Cc: Nils Kanning , 22146@debbugs.gnu.org, David Kastrup X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Mos=C3=A8 Giordano writes: >> I tried going up to a maximum of 30000 and it still didn't overflow, > > It does for me, from 16667 to be precise. Interesting. >> 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. > > I don't have write access to Emacs repo :-) Good excuse for not having to touch reftex. :-) I've changed it now to use \{0,2000\} instead of *. Bye, Tassilo From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 13 13:55:27 2015 Received: (at 22146-done) by debbugs.gnu.org; 13 Dec 2015 18:55:27 +0000 Received: from localhost ([127.0.0.1]:50508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8Bnr-0004jv-8s for submit@debbugs.gnu.org; Sun, 13 Dec 2015 13:55:27 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44416) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a8Bnp-0004jo-Vl for 22146-done@debbugs.gnu.org; Sun, 13 Dec 2015 13:55:26 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id CD2482057D for <22146-done@debbugs.gnu.org>; Sun, 13 Dec 2015 13:55:25 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Sun, 13 Dec 2015 13:55:25 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=Yp/DugXQ35c6405MZR0wNg35htw=; b=s2M8i QixVcQrCwQo2/JITIXd9DgJSYhsQpmXrfyQRsDLHDJtlMyFhmMIKUDv/ItkcrEn3 cCVzQ0dPQPJkizOxoMJACEynqfgqz02zc9thc5ety6ecZ55iXKLqLTCK/kra65vm E4dlBqzcR6uPf2+CVmhpaHf5eXjRgGYzyfHeqY= X-Sasl-enc: azj0ptblQIyxtYHD4FdQYIrRHd7fru9/d1KU9FNF/itf 1450032925 Received: from thinkpad-t440p (unknown [2.160.198.191]) by mail.messagingengine.com (Postfix) with ESMTPA id A9D40C013FE; Sun, 13 Dec 2015 13:55:24 -0500 (EST) From: Tassilo Horn To: David Kastrup Subject: Re: bug#22146: Stack overflow in reftex-parse-all References: <1449867804.3214.18.camel@kanning.de> <87a8pg9k57.fsf@gnu.org> <871taskmnb.fsf@fencepost.gnu.org> <87r3iq9yhg.fsf@fencepost.gnu.org> <87y4cynv9c.fsf@gnu.org> <87y4cyw8ai.fsf@gnu.org> <87io429qxb.fsf@fencepost.gnu.org> Date: Sun, 13 Dec 2015 19:55:22 +0100 In-Reply-To: <87io429qxb.fsf@fencepost.gnu.org> (David Kastrup's message of "Sun, 13 Dec 2015 18:52:48 +0100") Message-ID: <87r3iq18md.fsf@gnu.org> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 22146-done Cc: Nils Kanning , 22146-done@debbugs.gnu.org, =?utf-8?Q?Mos=C3=A8?= Giordano X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) David Kastrup writes: >> Isn't the syntax "\\[[^]]\\{0,1000\\}\\> 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 From unknown Sat Jun 21 12:13:09 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 11 Jan 2016 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator