From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#24358: 25.1.50; re-search-forward errors with "Variable binding depth exceeds max-specpdl-size" Date: Mon, 24 Oct 2016 11:33:11 -0400 Message-ID: References: <83insov1zr.fsf@gnu.org> <87zilztzd5.fsf@users.sourceforge.net> <83oa2ftnvp.fsf@gnu.org> <87wph2ts1a.fsf@users.sourceforge.net> <83oa2erx0k.fsf@gnu.org> <87lgxht8hp.fsf@users.sourceforge.net> <871sz8kq2v.fsf@gmail.com> <87shroroh8.fsf@users.sourceforge.net> <838ttfpnxt.fsf@gnu.org> <83vawjo21l.fsf@gnu.org> <83bmybnopx.fsf@gnu.org> <8360ojnk0n.fsf@gnu.org> <83twc3m198.fsf@gnu.org> <83pomrlz27.fsf@gnu.org> <83k2cynabi.fsf@gnu.org> <87eg35swni.fsf@users.sourceforge.net> <83lgxd50ic.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1477323891 29433 195.159.176.226 (24 Oct 2016 15:44:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 24 Oct 2016 15:44:51 +0000 (UTC) Cc: Sam Halliday , 24358@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 24 17:44:47 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 1byhQY-0006SW-8W for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Oct 2016 17:44:42 +0200 Original-Received: from localhost ([::1]:47575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byhQa-0003J3-H0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Oct 2016 11:44:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byhGJ-0001wL-Ex for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 11:34:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byhGE-0005Rp-Lk for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 11:34:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byhGE-0005Rg-I5 for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 11:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1byhGE-0001S2-8F for bug-gnu-emacs@gnu.org; Mon, 24 Oct 2016 11:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Oct 2016 15:34:02 +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: patch fixed Original-Received: via spool by 24358-submit@debbugs.gnu.org id=B24358.14773232005509 (code B ref 24358); Mon, 24 Oct 2016 15:34:02 +0000 Original-Received: (at 24358) by debbugs.gnu.org; 24 Oct 2016 15:33:20 +0000 Original-Received: from localhost ([127.0.0.1]:54047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byhFX-0001Qn-P8 for submit@debbugs.gnu.org; Mon, 24 Oct 2016 11:33:19 -0400 Original-Received: from mail-oi0-f46.google.com ([209.85.218.46]:33133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byhFW-0001Qb-I7 for 24358@debbugs.gnu.org; Mon, 24 Oct 2016 11:33:18 -0400 Original-Received: by mail-oi0-f46.google.com with SMTP id y2so45088717oie.0 for <24358@debbugs.gnu.org>; Mon, 24 Oct 2016 08:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=usPl5PIXeRi6w+f1tbX7pNPKTGS+2/AwHqf5RzOZGfs=; b=xBi+uefOxLEzwaMefoam5oZJbOUhJegAcm4Ki3F7f+BXkKirDRLhqsABpXPRx+WRR1 OaQq7UyMYjwQIk5hNuw1KKa76HjFzsRKWOovYdeVZaN85wf/EFrDCmEAgFXZXTYATIzN jVyQS/NJ/t6xq7PwqZONVG5WmuaB/PYkDg8D7Q1UCsV7UQNZJUyXZtgYSeG1VuafzNZc ATOIHuEJFmCSYlZ+Du8eUhrIo+pS7sxlfSwXCueOMlrmidTJB/GHeu7luckmJQwTOzIh 1rJ4oWCyV5ff7mD3q81f2TT029nyPzNjdlljHm4m4MKNlW/zxQ5O/4IgPa1S/ouMDq79 eTsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=usPl5PIXeRi6w+f1tbX7pNPKTGS+2/AwHqf5RzOZGfs=; b=Zs8CBJr7I7CSba6V5mLiv5RUdcpKapf6pEFgk/Z140X5xPGjgukonDkuRASgh4Mb89 E4K+iJlCAAUWcpFqnqvPgyCtc4BA/+2GtUaXED4KgJmwW+iip1XzPsqJbysMfJzuc1l+ Z9csjK4b0kaDf7FD5HCKc2GwtcHW2Jn+9HPf279MBPd/LrGSPkXrlKxSGc3XUMrKPl6q 0fjUjOCzJUOJKu7mdEMd1wz2UwTcFTKQkRZk3gKIbpBvWs8EnotiLCUldwddZMq1nRKF syCRjP/l+rkt4ymMnc5IRw1d7FQkRdYlmbvIT35VBOAENNYi7NJgRpZsQ+cdisnj3VPC 2rnw== X-Gm-Message-State: ABUngvd9jgWr0Yx4poA/Jb5sGKP5SY1J2YWtIfnJoQwnx+Gnou6Rlc0ax5+i5rKqstgtM5wZVjx7Jjog/+wW8Q== X-Received: by 10.157.54.230 with SMTP id s35mr1608514otd.169.1477323192744; Mon, 24 Oct 2016 08:33:12 -0700 (PDT) Original-Received: by 10.157.29.239 with HTTP; Mon, 24 Oct 2016 08:33:11 -0700 (PDT) In-Reply-To: <83lgxd50ic.fsf@gnu.org> X-Google-Sender-Auth: SFpAamRAN1rdiDL7faKzoJvwLl8 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:124959 Archived-At: On Mon, Oct 24, 2016 at 9:39 AM, Eli Zaretskii wrote: >> From: npostavs@users.sourceforge.net >> Cc: 24358@debbugs.gnu.org, sam.halliday@gmail.com >> Date: Mon, 24 Oct 2016 09:29:21 -0400 >> >> > regstart[*p] = d; >> > [...] >> > regs->start[reg] = POINTER_TO_OFFSET (regstart[reg]); >> > >> > POINTER_TO_OFFSET assumes that the pointer in regstart[reg] is >> > consistent with the current base address of the string into which it >> > points. Did you study this aspect of regex.c when you decided which >> > values need to be affected by relocation? >> >> I did not look at that before, but looking now, I don't see why it would >> be a problem. I put the base address updating code around the only >> place where malloc may be called, so string1 and string2 (which >> POINTER_TO_OFFSET uses) should always be consistent with the base >> address (unless there is some other malloc call that I missed?). > > What bothers me is this: could it be that relocation happens between > the first and the second line above? If it can, then what > POINTER_TO_OFFSET does will be inconsistent with the base address at > the time regstart[*p] was assigned the value of d. > > The code runs in a loop, or so it seems, so it's hard to reason about > time sequences. Oh, I see. Yes, I think you're right, the pointers stored in regstart, regend, and fail_stack could become inconsistent. Hard to say what kind of regex could trigger it, but it seems quite possible.