bug-texinfo
[Top][All Lists]
Advanced

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

Re: info crashes if .infokey contains the "invalid" action


From: Ken Brown
Subject: Re: info crashes if .infokey contains the "invalid" action
Date: Fri, 4 Mar 2016 12:08:22 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 3/3/2016 7:21 PM, Ken Brown wrote:
A Cygwin user reported a crash as in the subject.  I traced it to line
468 of info/infokey.c, in which there is a reference to
function_doc_array[a] with a == A_INVALID:

   ke.value.function = &function_doc_array[a];

As a result, ke.value.function contains garbage.  The following patch
appears to fix the problem in very limited testing:

Index: info/infokey.c
===================================================================
--- info/infokey.c      (revision 7037)
+++ info/infokey.c      (working copy)
@@ -465,7 +465,9 @@
                        KEYMAP_ENTRY ke;

                        ke.type = ISFUNC;
-                      ke.value.function = &function_doc_array[a];
+                      ke.value.function = a < A_NCOMMANDS ?
+                                &function_doc_array[a]
+                                : NULL;
                        To_seq (0);

                        if (section == info)


This isn't the right fix. It prevents the crash, but it doesn't correctly process the "invalid" line in .infokey. I tested with the following .infokey:

$ cat .infokey
#info
^a invalid

After startup, ^a still moved to the beginning of the line. I won't try to fix this right now, because someone familiar with the code can probably do it much faster.

Ken




reply via email to

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