From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24751: 26.0.50; Regex stack overflow not detected properly (gets "Variable binding depth exceeds max-specpdl-size") Date: Wed, 16 Nov 2016 18:25:22 +0200 Message-ID: <83polvfl3h.fsf@gnu.org> References: <87twc6tl0i.fsf@users.sourceforge.net> <83h97nlknj.fsf@gnu.org> <87mvhdoh4q.fsf@users.sourceforge.net> <83zilcipcr.fsf@gnu.org> <87a8d4lyzo.fsf@users.sourceforge.net> <83a8d3cq9s.fsf@gnu.org> <87wpg5l9st.fsf@users.sourceforge.net> <83d1hwhgdi.fsf@gnu.org> <87r36ckzca.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1479313676 24295 195.159.176.226 (16 Nov 2016 16:27:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Nov 2016 16:27:56 +0000 (UTC) Cc: 24751@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 16 17:27:52 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c733u-0005nN-KI for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Nov 2016 17:27:50 +0100 Original-Received: from localhost ([::1]:53342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c733y-0006Wn-0r for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Nov 2016 11:27:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c732D-0005bC-GW for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2016 11:26:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c732A-0005Ot-CP for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2016 11:26:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44371) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c732A-0005On-9c for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2016 11:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c732A-00020Y-4x for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2016 11:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Nov 2016 16:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24751 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24751-submit@debbugs.gnu.org id=B24751.14793135467687 (code B ref 24751); Wed, 16 Nov 2016 16:26:02 +0000 Original-Received: (at 24751) by debbugs.gnu.org; 16 Nov 2016 16:25:46 +0000 Original-Received: from localhost ([127.0.0.1]:59770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c731u-0001zv-2I for submit@debbugs.gnu.org; Wed, 16 Nov 2016 11:25:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c731s-0001zj-4X for 24751@debbugs.gnu.org; Wed, 16 Nov 2016 11:25:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c731j-0005DJ-Oz for 24751@debbugs.gnu.org; Wed, 16 Nov 2016 11:25:39 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c731j-0005DC-Lh; Wed, 16 Nov 2016 11:25:35 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4301 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c731h-0007PX-Ag; Wed, 16 Nov 2016 11:25:35 -0500 In-reply-to: <87r36ckzca.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125758 Archived-At: > From: npostavs@users.sourceforge.net > Cc: 24751@debbugs.gnu.org > Date: Tue, 15 Nov 2016 20:06:29 -0500 > > >> @@ -869,6 +869,7 @@ main (int argc, char **argv) > >> > >> /* Don't let regex.c overflow the stack. */ > >> re_max_failures = lim < extra ? 0 : min (lim - extra, SIZE_MAX) / ratio; > >> + emacs_re_safe_alloca = re_max_failures * min_ratio; > >> } > >> #endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */ > > > > . we shouldn't set re_max_failures to zero if the amount of stack is > > less than 'extra', since in that case we will allocate the failure > > stack off the heap; > > Then what should we set it to? Maybe we shouldn't modify it at all, > since the stack isn't actually a limiting factor? Yes, I think this is the best solution. Thanks.