GNU bug report logs - #59029
Dumping Emacs crashes when buffers have overlays

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Matt Armstrong <matt@HIDDEN>; Keywords: patch; dated Fri, 4 Nov 2022 23:10:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) patch. Request was from Matt Armstrong <matt@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 59029 <at> debbugs.gnu.org:


Received: (at 59029) by debbugs.gnu.org; 5 Nov 2022 18:09:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 05 14:09:42 2022
Received: from localhost ([127.0.0.1]:58009 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1orNbx-0001nl-Uu
	for submit <at> debbugs.gnu.org; Sat, 05 Nov 2022 14:09:42 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43737)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt@HIDDEN>) id 1orNbv-0001nY-RS
 for 59029 <at> debbugs.gnu.org; Sat, 05 Nov 2022 14:09:40 -0400
Received: (Authenticated sender: matt@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id B141AE0012;
 Sat,  5 Nov 2022 18:09:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1;
 t=1667671773;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=U8uwAOw0FutMcHWwd3vPawsZ8z90Pm0lPQcCIdVcEqY=;
 b=IqUxkmDRqdEjcmRTpDrogBTUEAt5/ROVUVWc6wWKq0v5YD87pMB9I99fgjGAl3ExLsUzPm
 lL+iDLS3wSlOByp45huNNpUSzqpFiTt/vPObOvwIfBfzW8tja6DA9cTOOtgt9DEIemETME
 e0mHdPggyO3k2JIYyiIhkNGQphBb/+V9dNod7Ym10bFxppnWfDlG9rzAw26P4IVfBolP7N
 JM7xQD9CSTyxVNO5VauKnwaJLxzPecL7bNQQKLU0qPd8cKBDU4vLhMERddYRCVB4kOcmo3
 b1UFf4wmRomDAjcNpIZ+nPkSV0y9Xss6zOXV/YirOKkPREm3Z2BHydRG7kg/uw==
Received: from matt by naz with local (Exim 4.96)
 (envelope-from <matt@HIDDEN>) id 1orNbl-0006Cm-34;
 Sat, 05 Nov 2022 11:09:29 -0700
From: Matt Armstrong <matt@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: bug#59029: 29.0.50; noverlay: pdumper.c: dump_interval_node
 recursion has no base case
In-Reply-To: <m2zgd6vtyi.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llman?=
 =?utf-8?Q?n=22's?= message of "Sat, 05 Nov 2022 06:41:41 +0100")
References: <87leoqwc4o.fsf@HIDDEN> <m2zgd6vtyi.fsf@HIDDEN>
Date: Sat, 05 Nov 2022 11:09:29 -0700
Message-ID: <87cza1w9wm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 59029
Cc: 59029 <at> debbugs.gnu.org, stefan monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:

> Yes, I think you are right.
>
> Could we also rename dump_interval_node to dump_itree_node?  There is
> another function dump_interval_tree for text properties, which is a bit
> confusing.

Attached renames the function and tags two related FIXMEs with this bug
number.  The root issue is that pdumping buffers with overlays is not
implemented.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0005-Add-FIXME-comments-for-overlays.patch

From 82c448f7f6eda810114151b5339d500fd6cf5826 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt@HIDDEN>
Date: Sat, 5 Nov 2022 11:03:09 -0700
Subject: [PATCH 5/5] Add FIXME comments for overlays.

* src/pdumper.c (dump_itree_node): Renamed from dump_interval_node.
Add FIXME(Matt): comment for bug#59029.
(dump_buffer): Tag comment with FIXME bug#59029.
---
 src/pdumper.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/pdumper.c b/src/pdumper.c
index 0a5d96dbb7c..10b6f58bbd8 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2134,8 +2134,8 @@ dump_marker (struct dump_context *ctx, const struct Lisp_Marker *marker)
 }
 
 static dump_off
-dump_interval_node (struct dump_context *ctx, struct itree_node *node,
-                    dump_off parent_offset)
+dump_itree_node (struct dump_context *ctx, struct itree_node *node,
+		 dump_off parent_offset)
 {
 #if CHECK_STRUCTS && !defined (HASH_itree_node_50DE304F13)
 # error "itree_node changed. See CHECK_STRUCTS comment in config.h."
@@ -2158,21 +2158,25 @@ dump_interval_node (struct dump_context *ctx, struct itree_node *node,
   DUMP_FIELD_COPY (&out, node, rear_advance);
   DUMP_FIELD_COPY (&out, node, front_advance);
   dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
+  /* FIXME: bug#59029 We haven't implemented the code to dump overlays
+     that are part of a buffer.  The code below will recurse forever
+     if any of parent, left or right is non-NULL, but isn't worth
+     changing until we have a test case.  */
   if (node->parent)
       dump_remember_fixup_ptr_raw
 	(ctx,
 	 offset + dump_offsetof (struct itree_node, parent),
-	 dump_interval_node (ctx, node->parent, offset));
+	 dump_itree_node (ctx, node->parent, offset));
   if (node->left)
       dump_remember_fixup_ptr_raw
 	(ctx,
 	 offset + dump_offsetof (struct itree_node, left),
-	 dump_interval_node (ctx, node->left, offset));
+	 dump_itree_node (ctx, node->left, offset));
   if (node->right)
       dump_remember_fixup_ptr_raw
 	(ctx,
 	 offset + dump_offsetof (struct itree_node, right),
-	 dump_interval_node (ctx, node->right, offset));
+	 dump_itree_node (ctx, node->right, offset));
   return offset;
 }
 
@@ -2189,7 +2193,7 @@ dump_overlay (struct dump_context *ctx, const struct Lisp_Overlay *overlay)
   dump_remember_fixup_ptr_raw
     (ctx,
      offset + dump_offsetof (struct Lisp_Overlay, interval),
-     dump_interval_node (ctx, overlay->interval, offset));
+     dump_itree_node (ctx, overlay->interval, offset));
   return offset;
 }
 
@@ -2864,7 +2868,8 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
   DUMP_FIELD_COPY (out, buffer, long_line_optimizations_p);
 
   if (buffer->overlays && buffer->overlays->root != NULL)
-    /* We haven't implemented the code to dump overlays.  */
+    /* FIXME: bug#59029 We haven't implemented the code to dump
+       overlays that are in a buffer.  */
     emacs_abort ();
   else
     out->overlays = NULL;
-- 
2.35.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59029; Package emacs. Full text available.
Changed bug title to 'Dumping Emacs crashes when buffers have overlays' from '29.0.50; noverlay: pdumper.c: dump_interval_node recursion has no base case' Request was from Matt Armstrong <matt@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 59029 <at> debbugs.gnu.org:


Received: (at 59029) by debbugs.gnu.org; 5 Nov 2022 05:41:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 05 01:41:53 2022
Received: from localhost ([127.0.0.1]:55313 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1orBwG-0003uN-LT
	for submit <at> debbugs.gnu.org; Sat, 05 Nov 2022 01:41:53 -0400
Received: from mail-ed1-f48.google.com ([209.85.208.48]:39462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1orBwD-0003u2-18
 for 59029 <at> debbugs.gnu.org; Sat, 05 Nov 2022 01:41:50 -0400
Received: by mail-ed1-f48.google.com with SMTP id f7so10350645edc.6
 for <59029 <at> debbugs.gnu.org>; Fri, 04 Nov 2022 22:41:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=JLx5uQU6POKTXM1+DX38rzmmgN8lknzYRrgfAACpD/o=;
 b=EOOsKX5hyIjYCIJI8yfb88jmklgEIfgScvm7aoG7BKjlTr/f6/XQNky5sjazNfjRUO
 uw6y069mysm1FB4LD2vGZT2VIB+QL+2ekRfUA0uJaGweVOr2TaxoKE6hQzWq4yThq0s+
 iijXV1NhK/L+Vc2M+IJt+q5rfh02FHaPq3NQPPEtsG9xDuWhXabk8+NuN7aR4jPSrtAv
 wguasFLzpV8vea21TaE+NeOLY6pQfEWyF64nOrg9NVa+P3wO4v8VEc1Z/AbWNFsKRKCr
 kl08D8Yz2n1MbjwlNTwQ6jr6g1kVCtLePQl0sJ6b2sY+1TxXOAmbNApqFr5qUeeBA+GB
 goAg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=JLx5uQU6POKTXM1+DX38rzmmgN8lknzYRrgfAACpD/o=;
 b=LVEQ/mK5sxpjcNaeEPXOFLjDHDAJSJNQrof6yIOzL1eltsxDzkndcxQQ65Bqt9zHSM
 nR0kRuCkJcvhhFiYmDduBvqEt0C2zKwoJViOGO0ZQI5RmrLgCDslOeN0CCn7znMA/r94
 tKDw9Iq3HMa4SeS4JDdU30F6YJ+7IzAAhI5DOGSQfgKKUt9hkxRIxC57SFIRN8rarIRy
 TVQDXCLh3ZcLSX2cON5EkDzdEdZFkUohslmCm0NxNH+ipcyQKiMEMPeMLkAdyFH6W19Y
 9upBHup+txKnyJvPBVbXJS0gF78hf1hK3wWPiF/4w9fEad4dKKKyXbsPuhpIVb/u+VUN
 JCHA==
X-Gm-Message-State: ACrzQf0lt61qLP1VGXRl1hRua+BmPWTrZYPJBjGwkZPti+WJSh06fiOY
 FR8ASiAm9QP1wCQ7xPMQx/4=
X-Google-Smtp-Source: AMsMyM7m47wneVPXBji304x1Ap+UGunj42IvrUR8m7YskZ3J6UWS7BiPQL1KqAQeHIdfYqaCmz6tEg==
X-Received: by 2002:a05:6402:1004:b0:464:778:c516 with SMTP id
 c4-20020a056402100400b004640778c516mr17098805edu.348.1667626902987; 
 Fri, 04 Nov 2022 22:41:42 -0700 (PDT)
Received: from Mini.fritz.box (p4fe3a85e.dip0.t-ipconnect.de. [79.227.168.94])
 by smtp.gmail.com with ESMTPSA id
 x14-20020a170906134e00b0073022b796a7sm461927ejb.93.2022.11.04.22.41.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 04 Nov 2022 22:41:42 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Matt Armstrong <matt@HIDDEN>
Subject: Re: bug#59029: 29.0.50; noverlay: pdumper.c: dump_interval_node
 recursion has no base case
In-Reply-To: <87leoqwc4o.fsf@HIDDEN> (Matt Armstrong's message of "Fri, 04
 Nov 2022 16:09:11 -0700")
References: <87leoqwc4o.fsf@HIDDEN>
Date: Sat, 05 Nov 2022 06:41:41 +0100
Message-ID: <m2zgd6vtyi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 59029
Cc: 59029 <at> debbugs.gnu.org, stefan monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Matt Armstrong <matt@HIDDEN> writes:

> X-Debbugs-cc: Stefan Monnier <monnier@HIDDEN>
>
> This has been in my head for weeks but I haven't had time to dig into
> it.  Best get it in a bug.
>
> See the code for dump_interval_node() in pdumper.c below.
>
> Imagine 'node' has a left child.  It will recurse to that child on line
> 35.  That child will recurse back to its parent on line 30.  That parent
> will recurse back to its left child on line 35.  This will repeat until
> the stack blows.  All you need is two nodes in the tree.
>
> This is not an immediate issue today because apparently Emacs does not
> dump any buffers with overlays present, or at least, never more than one
> overlay.  I suspect the right fix is to delete lines 26-30, or something
> like that, but I can't claim I understand this code.
>
>      1	static dump_off
>      2	dump_interval_node (struct dump_context *ctx, struct itree_node *node,
>      3	                    dump_off parent_offset)
>      4	{
>      5	#if CHECK_STRUCTS && !defined (HASH_itree_node_50DE304F13)
>      6	# error "itree_node changed. See CHECK_STRUCTS comment in config.h."
>      7	#endif
>      8	  struct itree_node out;
>      9	  dump_object_start (ctx, &out, sizeof (out));
>     10	  if (node->parent)
>     11	    dump_field_fixup_later (ctx, &out, node, &node->parent);
>     12	  if (node->left)
>     13	    dump_field_fixup_later (ctx, &out, node, &node->parent);
>     14	  if (node->right)
>     15	    dump_field_fixup_later (ctx, &out, node, &node->parent);
>     16	  DUMP_FIELD_COPY (&out, node, begin);
>     17	  DUMP_FIELD_COPY (&out, node, end);
>     18	  DUMP_FIELD_COPY (&out, node, limit);
>     19	  DUMP_FIELD_COPY (&out, node, offset);
>     20	  DUMP_FIELD_COPY (&out, node, otick);
>     21	  dump_field_lv (ctx, &out, node, &node->data, WEIGHT_STRONG);
>     22	  DUMP_FIELD_COPY (&out, node, red);
>     23	  DUMP_FIELD_COPY (&out, node, rear_advance);
>     24	  DUMP_FIELD_COPY (&out, node, front_advance);
>     25	  dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
>     26	  if (node->parent)
>     27	      dump_remember_fixup_ptr_raw
>     28		(ctx,
>     29		 offset + dump_offsetof (struct itree_node, parent),
>     30		 dump_interval_node (ctx, node->parent, offset));
>     31	  if (node->left)
>     32	      dump_remember_fixup_ptr_raw
>     33		(ctx,
>     34		 offset + dump_offsetof (struct itree_node, left),
>     35		 dump_interval_node (ctx, node->left, offset));
>     36	  if (node->right)
>     37	      dump_remember_fixup_ptr_raw
>     38		(ctx,
>     39		 offset + dump_offsetof (struct itree_node, right),
>     40		 dump_interval_node (ctx, node->right, offset));
>     41	  return offset;
>     42	}

Yes, I think you are right.

Could we also rename dump_interval_node to dump_itree_node?  There is
another function dump_interval_tree for text properties, which is a bit
confusing.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59029; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Nov 2022 23:09:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 04 19:09:26 2022
Received: from localhost ([127.0.0.1]:55051 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1or5oT-0001Nn-Pv
	for submit <at> debbugs.gnu.org; Fri, 04 Nov 2022 19:09:26 -0400
Received: from lists.gnu.org ([209.51.188.17]:41244)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt@HIDDEN>) id 1or5oQ-0001NY-Vh
 for submit <at> debbugs.gnu.org; Fri, 04 Nov 2022 19:09:24 -0400
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 <matt@HIDDEN>) id 1or5oQ-0008Sx-RW
 for bug-gnu-emacs@HIDDEN; Fri, 04 Nov 2022 19:09:22 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <matt@HIDDEN>) id 1or5oN-0005wi-Va
 for bug-gnu-emacs@HIDDEN; Fri, 04 Nov 2022 19:09:22 -0400
Received: (Authenticated sender: matt@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id A2FF820003
 for <bug-gnu-emacs@HIDDEN>; Fri,  4 Nov 2022 23:09:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1;
 t=1667603355;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=7rz1iVY55ljXo90EY8HgLkeOeR9W+x92XHpS0cv4xN0=;
 b=okZlgP/04vnqJF4usJfWcZ0Z3KobR0ezeO+kCV637kzy2KB5s8Tsyqv77aISj03UyYcA8Q
 9kkD/bw+oXRnNBwtCzukSQMtxPAT9KxFjxHaudhuasAzbaa3dCwAjaF37JZz/VlkfUXt+S
 Ahc3fX7BNeTHhf1UV23okHphnNHgOv9I5zlZWO0aACDG30xyBzfoYUhrLO1GkQeRtAJtCQ
 e5dOpYb+lUSIpRopdhmM/hprQQSAlnBuQjaIoGZYCqYktxRKAgTgQZKftvoUxFVG9yrEcA
 hDuOUKbV5f9/Lr0cdtN4Y/iZnzFRhGCfUaNPEEPc95TarMFqMqqZNkTO9chVtw==
Received: from matt by naz with local (Exim 4.96)
 (envelope-from <matt@HIDDEN>) id 1or5oF-002BZ2-2d
 for bug-gnu-emacs@HIDDEN; Fri, 04 Nov 2022 16:09:11 -0700
From: Matt Armstrong <matt@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; noverlay: pdumper.c: dump_interval_node recursion has no
 base case
Date: Fri, 04 Nov 2022 16:09:11 -0700
Message-ID: <87leoqwc4o.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=217.70.183.200; envelope-from=matt@HIDDEN;
 helo=relay7-d.mail.gandi.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

X-Debbugs-cc: Stefan Monnier <monnier@HIDDEN>

This has been in my head for weeks but I haven't had time to dig into
it.  Best get it in a bug.

See the code for dump_interval_node() in pdumper.c below.

Imagine 'node' has a left child.  It will recurse to that child on line
35.  That child will recurse back to its parent on line 30.  That parent
will recurse back to its left child on line 35.  This will repeat until
the stack blows.  All you need is two nodes in the tree.

This is not an immediate issue today because apparently Emacs does not
dump any buffers with overlays present, or at least, never more than one
overlay.  I suspect the right fix is to delete lines 26-30, or something
like that, but I can't claim I understand this code.

     1	static dump_off
     2	dump_interval_node (struct dump_context *ctx, struct itree_node *node,
     3	                    dump_off parent_offset)
     4	{
     5	#if CHECK_STRUCTS && !defined (HASH_itree_node_50DE304F13)
     6	# error "itree_node changed. See CHECK_STRUCTS comment in config.h."
     7	#endif
     8	  struct itree_node out;
     9	  dump_object_start (ctx, &out, sizeof (out));
    10	  if (node->parent)
    11	    dump_field_fixup_later (ctx, &out, node, &node->parent);
    12	  if (node->left)
    13	    dump_field_fixup_later (ctx, &out, node, &node->parent);
    14	  if (node->right)
    15	    dump_field_fixup_later (ctx, &out, node, &node->parent);
    16	  DUMP_FIELD_COPY (&out, node, begin);
    17	  DUMP_FIELD_COPY (&out, node, end);
    18	  DUMP_FIELD_COPY (&out, node, limit);
    19	  DUMP_FIELD_COPY (&out, node, offset);
    20	  DUMP_FIELD_COPY (&out, node, otick);
    21	  dump_field_lv (ctx, &out, node, &node->data, WEIGHT_STRONG);
    22	  DUMP_FIELD_COPY (&out, node, red);
    23	  DUMP_FIELD_COPY (&out, node, rear_advance);
    24	  DUMP_FIELD_COPY (&out, node, front_advance);
    25	  dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
    26	  if (node->parent)
    27	      dump_remember_fixup_ptr_raw
    28		(ctx,
    29		 offset + dump_offsetof (struct itree_node, parent),
    30		 dump_interval_node (ctx, node->parent, offset));
    31	  if (node->left)
    32	      dump_remember_fixup_ptr_raw
    33		(ctx,
    34		 offset + dump_offsetof (struct itree_node, left),
    35		 dump_interval_node (ctx, node->left, offset));
    36	  if (node->right)
    37	      dump_remember_fixup_ptr_raw
    38		(ctx,
    39		 offset + dump_offsetof (struct itree_node, right),
    40		 dump_interval_node (ctx, node->right, offset));
    41	  return offset;
    42	}




Acknowledgement sent to Matt Armstrong <matt@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#59029; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 5 Nov 2022 19:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.