From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#59029: 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@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="975"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefan monnier To: 59029@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 05 00:10:46 2022 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 1or5pl-000AWx-B9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Nov 2022 00:10:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1or5pG-0008WV-7f; Fri, 04 Nov 2022 19:10:14 -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 1or5p5-0008Vp-57 for bug-gnu-emacs@gnu.org; Fri, 04 Nov 2022 19:10:03 -0400 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 1or5p4-0005zq-95 for bug-gnu-emacs@gnu.org; Fri, 04 Nov 2022 19:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1or5p3-0001P1-U5; Fri, 04 Nov 2022 19:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Nov 2022 23:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59029 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: stefan monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.16676033665324 (code B ref -1); Fri, 04 Nov 2022 23:10:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Nov 2022 23:09:26 +0000 Original-Received: from localhost ([127.0.0.1]:55051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1or5oT-0001Nn-Pv for submit@debbugs.gnu.org; Fri, 04 Nov 2022 19:09:26 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:41244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1or5oQ-0001NY-Vh for submit@debbugs.gnu.org; Fri, 04 Nov 2022 19:09:24 -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 1or5oQ-0008Sx-RW for bug-gnu-emacs@gnu.org; Fri, 04 Nov 2022 19:09:22 -0400 Original-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 ) id 1or5oN-0005wi-Va for bug-gnu-emacs@gnu.org; Fri, 04 Nov 2022 19:09:22 -0400 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id A2FF820003 for ; 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== Original-Received: from matt by naz with local (Exim 4.96) (envelope-from ) id 1or5oF-002BZ2-2d for bug-gnu-emacs@gnu.org; Fri, 04 Nov 2022 16:09:11 -0700 Received-SPF: pass client-ip=217.70.183.200; envelope-from=matt@rfc20.org; 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-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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247121 Archived-At: X-Debbugs-cc: Stefan Monnier 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 }