bug-texinfo
[Top][All Lists]
Advanced

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

[PATCH] ginfo: SIGSEGV on "Pick last item in node's menu"


From: Malcolm Rowe
Subject: [PATCH] ginfo: SIGSEGV on "Pick last item in node's menu"
Date: Wed, 02 Jun 2004 21:32:37 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040117

Hi,

ginfo from Texinfo 4.7 will SIGSEGV whenever item '0' (the last item) is selected, because, in info_menu_digit(), the local variable 'entry' is only assigned a value for non-'0' items.

The attached patch fixes the problem by removing the use of 'entry' entirely - it is the same as menu[i] in all cases (and 'menu[i]' is already checked to determine if we found an entry).

Regards,
Malcolm
--- texinfo-4.7/info/session.c.orig     2004-06-02 21:08:37.000000000 +0100
+++ texinfo-4.7/info/session.c  2004-06-02 21:10:23.000000000 +0100
@@ -1942,11 +1942,11 @@
 
 /* Use KEY (a digit) to select the Nth menu item in WINDOW->node. */
 DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
 {
   register int i, item;
-  register REFERENCE *entry = NULL, **menu;
+  register REFERENCE **menu;
 
   menu = info_menu_of_node (window->node);
 
   if (!menu)
     {
@@ -1960,20 +1960,20 @@
   /* Special case.  Item "0" is the last item in this menu. */
   if (item == 0)
     for (i = 0; menu[i + 1]; i++);
   else
     {
-      for (i = 0; (entry = menu[i]); i++)
+      for (i = 0; menu[i]; i++)
         if (i == item - 1)
           break;
     }
 
   if (menu[i])
     {
       info_select_reference (window, menu[i]);
-      if (entry->line_number > 0)
-        info_next_line (window, entry->line_number - 1, key);
+      if (menu[i]->line_number > 0)
+        info_next_line (window, menu[i]->line_number - 1, key);
     }
   else
     info_error ((char *) _("There aren't %d items in this menu."),
         (void *) item, NULL);
 

reply via email to

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