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#24358: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size" Date: Sat, 08 Oct 2016 20:23:49 +0300 Message-ID: <838ttyhhzu.fsf@gnu.org> References: <87twe6sx2g.fsf@users.sourceforge.net> <87eg51ng4r.fsf_-_@users.sourceforge.net> <87k2djwumn.fsf@users.sourceforge.net> <83h98nidvd.fsf@gnu.org> <87eg3rvtsf.fsf@users.sourceforge.net> <83k2dihpm9.fsf@gnu.org> <8760p2wzgj.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1475947536 20144 195.159.176.226 (8 Oct 2016 17:25:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Oct 2016 17:25:36 +0000 (UTC) Cc: 24358@debbugs.gnu.org, peder@klingenberg.no To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 08 19:25:26 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 1bsvN3-0002WH-4I for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Oct 2016 19:25:13 +0200 Original-Received: from localhost ([::1]:41887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvN1-0001qz-My for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Oct 2016 13:25:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvMv-0001pa-Sa for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 13:25:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsvMs-0000Sz-0V for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 13:25:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvMr-0000Sq-T5 for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 13:25:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bsvMr-0008Lh-M4 for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2016 13:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2016 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24358 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24358-submit@debbugs.gnu.org id=B24358.147594745032020 (code B ref 24358); Sat, 08 Oct 2016 17:25:01 +0000 Original-Received: (at 24358) by debbugs.gnu.org; 8 Oct 2016 17:24:10 +0000 Original-Received: from localhost ([127.0.0.1]:48939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsvM2-0008KO-F3 for submit@debbugs.gnu.org; Sat, 08 Oct 2016 13:24:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33111) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsvM1-0008K9-G2 for 24358@debbugs.gnu.org; Sat, 08 Oct 2016 13:24:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsvLt-0008BG-7l for 24358@debbugs.gnu.org; Sat, 08 Oct 2016 13:24:04 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsvLa-0007z2-6v; Sat, 08 Oct 2016 13:23:42 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3000 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bsvLY-0002mh-6z; Sat, 08 Oct 2016 13:23:40 -0400 In-reply-to: <8760p2wzgj.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:124231 Archived-At: > From: npostavs@users.sourceforge.net > Cc: 24358@debbugs.gnu.org, peder@klingenberg.no > Date: Sat, 08 Oct 2016 12:57:32 -0400 > > >> Old value = 68 'D' > >> New value = 0 '\000' > > > > If that string is data of a Lisp string, then a call to malloc could > > relocate the data. Code that holds C pointers into buffer or string > > text should either use SREF, or recompute the C pointer after each > > function call which could GC. > > In that case, I believe the problem is that search_buffer calls > re_search_2 with a pointer to the buffer text, and then > re_match_2_internal (called by re_search_2), can allocate when doing > PUSH_FAILURE_POINT because it eventually does SAFE_ALLOCA to grow the > regex stack. > > AFAICT, this bug is still present 24.5, but because re_max_failures is > set to a round number (see > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24358#27), there are fewer > calls to malloc and thus less chance of relocating the particular string > in question. > > So possible solutions I can would be to pass down the lisp reference to > re_match_2_internal, or else set re_max_failures according to MAX_ALLOCA > (but this would make it much smaller). Do you see buffer text actually changing its address in this scenario? Otherwise, we might be chasing a wild goose. (Once we establish this is the problem, we could talk about the fix. IME, pointers could still be passed, but some extra caution is needed when using them.) Thanks.