texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Prevent M-x visit-menu segfault


From: Gavin D. Smith
Subject: branch master updated: Prevent M-x visit-menu segfault
Date: Tue, 16 Jan 2024 13:27:50 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 4f7bda3236 Prevent M-x visit-menu segfault
4f7bda3236 is described below

commit 4f7bda32361dbbdaf0a6b854adfb224161d22c55
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Jan 16 18:26:19 2024 +0000

    Prevent M-x visit-menu segfault
    
    * info/session.c (info_visit_menu): Copy the node structure from the
    current window before calling info_follow_reference, similarly to
    code in info_split_window.  This prevents a shared node in the
    window history, leading to possible memory problems.
    
    Segmentation fault following 'M-x visit-menu' and 'M-x delete-window'
    reported by Bugsy Abatantuono <bugsyabatantuono@proton.me>.
---
 ChangeLog      | 12 ++++++++++++
 info/session.c |  5 ++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d84d65be9b..f958f69c75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-01-16  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Prevent M-x visit-menu segfault
+
+       * info/session.c (info_visit_menu): Copy the node structure from the
+       current window before calling info_follow_reference, similarly to
+       code in info_split_window.  This prevents a shared node in the
+       window history, leading to possible memory problems.
+
+       Segmentation fault following 'M-x visit-menu' and 'M-x delete-window'
+       reported by Bugsy Abatantuono <bugsyabatantuono@proton.me>.
+
 2024-01-15  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/ConvertXS.xs (text_convert_tree): handle an
diff --git a/info/session.c b/info/session.c
index 1621b2123b..7c385aca51 100644
--- a/info/session.c
+++ b/info/session.c
@@ -2513,6 +2513,7 @@ DECLARE_INFO_COMMAND (info_visit_menu,
 {
   register int i;
   REFERENCE *entry, **menu;
+  NODE *copy;
 
   menu = window->node->references;
 
@@ -2528,8 +2529,10 @@ DECLARE_INFO_COMMAND (info_visit_menu,
 
       if (entry->type != REFERENCE_MENU_ITEM) continue;
 
+      copy = xmalloc (sizeof (NODE));
+      *copy = *window->node; /* Field-by-field copy of structure. */
       new = window_make_window ();
-      info_set_node_of_window (new, window->node);
+      info_set_node_of_window (new, copy);
       window_tile_windows (TILE_INTERNALS);
 
       if (!new)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]