From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#65726: 29.1.50; Crash in regexp engine Date: Wed, 6 Sep 2023 14:03:01 +0200 Message-ID: References: <8e1b4e50-0430-3eb3-e486-60def1e4821f@gmx.at> <83fs3u5e7u.fsf@gnu.org> <835y4q5apw.fsf@gnu.org> <776370AB-662F-4C0A-95BF-97DEA4F18F54@gmail.com> <3A0AC9E2-A420-47B6-870A-69C53FCAEF71@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16270"; mail-complaints-to="usenet@ciao.gmane.io" Cc: martin rudalics , Eli Zaretskii , 65726@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 06 14:04:48 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qdrH5-0003z0-Tg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Sep 2023 14:04:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdrGf-0002tb-Ir; Wed, 06 Sep 2023 08:04:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdrGO-0002kQ-Jf for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 08:04:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdrGL-0006RB-5a for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 08:04:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdrGM-0004pI-5n for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 08:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Sep 2023 12:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65726 X-GNU-PR-Package: emacs Original-Received: via spool by 65726-submit@debbugs.gnu.org id=B65726.169400180918484 (code B ref 65726); Wed, 06 Sep 2023 12:04:02 +0000 Original-Received: (at 65726) by debbugs.gnu.org; 6 Sep 2023 12:03:29 +0000 Original-Received: from localhost ([127.0.0.1]:33237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdrFe-0004np-7n for submit@debbugs.gnu.org; Wed, 06 Sep 2023 08:03:28 -0400 Original-Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:49279) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdrFX-0004nK-9d for 65726@debbugs.gnu.org; Wed, 06 Sep 2023 08:03:14 -0400 Original-Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-501cba1ec0aso636670e87.2 for <65726@debbugs.gnu.org>; Wed, 06 Sep 2023 05:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694001784; x=1694606584; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=KzFpz5auFfSXeSAH/yEcrOPv0eBejnw1Af21b/r7JQE=; b=AeMF3IItWLDNzQvJ1JYdSolGYjU98VpwK0JJzICHAOoE684AJcd42QTOa3s/yZIGa+ T51zI3aM/UzdnhRDr9Xj3qu6zYXLUHturs6w2wOZZggZsFSsHDIeBwJwOVFdOKwp2ByG JNzDlgAj7VVR4Jk+GAkrxLwJENsPzdrFy3J2mxm2rzx2GohqJwqTm5LBDbFHp0/uajHN nr7Q69WxprpcAT8b7VOHY9MJoNPbYgWrVjeYxjWMTf+7jLxNTobPtdhR3xG2c3ztU1hj GWOTHJiFEX+Bz0cYio2nN9KNmsOHxNxeiZrLCwhF6CWDQvjvpYErJk1/MapkgCsG97C8 ffnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694001784; x=1694606584; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KzFpz5auFfSXeSAH/yEcrOPv0eBejnw1Af21b/r7JQE=; b=ULGExqj8lPx6w2jOivtIvjwMJ2BmCLFKISpV7l0/qhAc89Dn80lBb54GKqX4HBlDLN 4gOcxhJ4En/3+zgl44W2pZFeKaDw69mmYiBIoNDRoQrDxVBTnhIm89+ZSMGDa3NgdTwQ ILs3Aatlr3NNrTI8PJW5WS48kc2s37zC7kazqZFQwz0zVaPrgggG6WnwWkOtR0i8ipn7 YvB7vcKMtbdvmDoo4lxp5pYmRXypYLuaK3Hc5q+PgcuEmVaO4vNUEqg7HBM+Do1PExPE pLuHzrRBv/ew37+vqkcfJTpA6YRk22j2uqK7dPdIX2+Q9ABaNZjnpmM4WWCCfAE025/d wj6g== X-Gm-Message-State: AOJu0YwwLl1OFvCGh7ZmRpMAOg9bCZVAf6aUcvyElN1/IWHlU8eD+ZJj kd56mvhOjqVWn/9JJ7Pn7IE= X-Google-Smtp-Source: AGHT+IFsrBpgFc+0C7gOZaONvbpQPi1EuXmrBuAqXiXJL30Oj8iujSoPAbhsDA5Pm+5t8Ys1ZU2vsQ== X-Received: by 2002:a19:915a:0:b0:500:aed0:cb1b with SMTP id y26-20020a19915a000000b00500aed0cb1bmr2219789lfj.24.1694001784001; Wed, 06 Sep 2023 05:03:04 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id i11-20020a056512006b00b004fe38e566cfsm2747534lfo.280.2023.09.06.05.03.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Sep 2023 05:03:03 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.15) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269523 Archived-At: 5 sep. 2023 kl. 17.33 skrev Stefan Monnier : > You can ignore the `mutually_exclusive_(charset|exactn)` thingies = which > just move code around (it's necessary for the patch). Actually that's a good refactoring to start with regardless of the path = we follow later. Makes things more readable if nothing else. > The basic idea is that `done` points to the beginning of the "current > loop": as long as we move forward we presume we may still be in the > current loop, and when we find a jump backward it's either a jump to = the > beginning of a new (nested/further) loop (so we move `done`) or a jump > to the same loop or to some earlier loop (which we presumably handle > elsewhere). So how can we describe the exact semantics of `done` in = mutually_exclusive_aux(p1,p2,done)? Something like: Let me(p1,p2) =3D true iff (p1 matches) implies (p2 fails). Then me_aux(p1,p2,done) =3D me(p1,p2) under the assumption that me(p1,x) holds for all x Adding an `assert (p2 >=3D done)` confirms that this does happen, Can you give an example of such a regexp? I ran `make check` with your = patch applied and checking enabled but got no assertion failure. > so > whether we return true or false when `p2 < done` does matter, so I = guess > we should go with the safer option unless we can really convince > ourselves that the more optimistic option is also correct. >=20 > Then again, maybe we should bite the bullet and actually keep track of > the positions already visited, so we don't need any "fancy" argument. There are a couple of ways of doing that but it might not be that bad. = It would also be more robust in face of future changes that may not obey = the current invariants.