From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#61514: 30.0.50; sadistically long xml line hangs emacs Date: Sat, 18 Feb 2023 23:06:10 +0000 Message-ID: References: <87lel0c65v.fsf@everybody.org> <838rgvymcd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11227"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "Mark A. Hershberger" , 61514@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 19 00:07:21 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 1pTWIa-0002hi-R2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Feb 2023 00:07:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTWIK-0006Hv-DN; Sat, 18 Feb 2023 18:07:04 -0500 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 1pTWII-0006HX-Fp for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 18:07:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pTWII-0005Ea-6r for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 18:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTWIH-0005ho-Oc for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 18:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Feb 2023 23:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61514 X-GNU-PR-Package: emacs Original-Received: via spool by 61514-submit@debbugs.gnu.org id=B61514.167676157821876 (code B ref 61514); Sat, 18 Feb 2023 23:07:01 +0000 Original-Received: (at 61514) by debbugs.gnu.org; 18 Feb 2023 23:06:18 +0000 Original-Received: from localhost ([127.0.0.1]:45145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTWHa-0005gm-6j for submit@debbugs.gnu.org; Sat, 18 Feb 2023 18:06:18 -0500 Original-Received: from heytings.org ([95.142.160.155]:34662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTWHZ-0005ge-46 for 61514@debbugs.gnu.org; Sat, 18 Feb 2023 18:06:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1676761573; bh=jPecWNFx6+U1KBf8HvK5zEsTKhA5tujfJAshX18BnUw=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=nX1lkgXL8jOFepgjP2dpBmMfjN8VbT8CuiSjpuZukPpl5vV8pyhfGYvREt6y4qGGr 3M2T14CcpCkhqMNM905ylh/s3o1IUskR1SGnJIwrVb0LlQ+CdYC/kY/0HE6oWwOgmZ TC8OO/Xnz7eBkdBbkfEQq4qJDs2L+LXZsZKQnjKPO0ozsHLJH1WuC1ESH5dj8Zl7NI VEBBPiJLhTcGZHb8v7nA/5ExoKst6zNEvofqVqB3O5oqQO5YB8jXq+3FVCTykjAs+v AYc/5CyAKKcbQZBooNaUh1zGPD4c4vgIaLEPh4SkLNIBS16gc8QBRhG1QnGk3699dm DuZ0SWBu2OfPw== In-Reply-To: <838rgvymcd.fsf@gnu.org> 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:256004 Archived-At: Interestingly, the following simple patch fixes both the original and the truncated cases: diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 2dca0d16ad9..eb943df46f0 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -877,7 +877,7 @@ #define INIT_FAILURE_ALLOC 20 whose default stack limit is 2mb. In order for a larger value to work reliably, you have to try to make it accord with the process stack limit. */ -ptrdiff_t emacs_re_max_failures = 40000; +ptrdiff_t emacs_re_max_failures = 37499; union fail_stack_elt { I obtained the magical 37499 value by bisecting. Both cases fail with 37500 (or higher), and work as expected (i.e. they fail with "Stack overflow in regexp matcher") with 37499. I don't know why exactly, but I note that: 37499 * 8 = 299992 and 37500 * 8 = 300000 (where 8 is sizeof (fail_stack_elt_t)) 37499 * 20 * 8 = 5999840 and 37500 * 20 * 8 = 6000000 (where 20 is TYPICAL_FAILURE_SIZE) so it seems that there is a kind of limit at exactly 6000000 bytes?