From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#40661: Crash in regex search during redisplay Date: Thu, 16 Apr 2020 18:36:36 +0300 Message-ID: <83ftd3e92z.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="66393"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40661@debbugs.gnu.org To: Richard Copley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 16 17:37:46 2020 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 1jP6aI-000HAQ-0N for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Apr 2020 17:37:46 +0200 Original-Received: from localhost ([::1]:36098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP6aH-0005za-2f for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Apr 2020 11:37:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51220) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP6Zb-0005MN-Sy for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2020 11:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jP6Za-0002Ic-7e for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2020 11:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55833) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jP6Za-0002IS-4P for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2020 11:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jP6Za-00037D-02 for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2020 11:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Apr 2020 15:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40661 X-GNU-PR-Package: emacs Original-Received: via spool by 40661-submit@debbugs.gnu.org id=B40661.158705142011967 (code B ref 40661); Thu, 16 Apr 2020 15:37:01 +0000 Original-Received: (at 40661) by debbugs.gnu.org; 16 Apr 2020 15:37:00 +0000 Original-Received: from localhost ([127.0.0.1]:39146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jP6ZX-00036x-O1 for submit@debbugs.gnu.org; Thu, 16 Apr 2020 11:36:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jP6ZW-00036l-WA for 40661@debbugs.gnu.org; Thu, 16 Apr 2020 11:36:59 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jP6ZR-0002En-Ou; Thu, 16 Apr 2020 11:36:53 -0400 Original-Received: from [176.228.60.248] (port=3496 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jP6ZP-0002Ja-T9; Thu, 16 Apr 2020 11:36:53 -0400 In-Reply-To: (message from Richard Copley on Thu, 16 Apr 2020 15:35:20 +0100) 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: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178453 Archived-At: > From: Richard Copley > Date: Thu, 16 Apr 2020 15:35:20 +0100 > > Recipe from emacs -Q: > > Save the text below in a file with extension ".pl". > Repeatedly: kill the buffer and visit the file again. (You can use > C-x C-v for this.) > > Emacs eventually encounters a segfault. Backtrace below. > > The text is reduced from a real program that exhibited the problem. > Repeating up to about 20 times is usually enough. You can use a > keyboard macro, [C-x ( C-x C-v RET C-x e e e e e], holding down the > 'e' key until you get the crash. Looks like GC sometimes kicks in while we are inside re_search_2 and have pointers to buffer text lying around. This seems to fix the crash for me: diff --git a/src/search.c b/src/search.c index 818bb4a..79423be 100644 --- a/src/search.c +++ b/src/search.c @@ -1188,6 +1188,7 @@ search_buffer_re (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t count = SPECPDL_INDEX (); freeze_buffer_relocation (); freeze_pattern (cache_entry); + inhibit_garbage_collection (); while (n < 0) {