[gnu.gdb.bug] GDB 3.2 Core dump due to readline.c

andrewt@watsnew.waterloo.edu (Andrew Thomas) (07/14/89)

There is a bug in GDB 3.2 such that if your ~/.inputrc file contains
an unrecognized command string, then GDB will core dump before it
gives you the first prompt due to referencing through a NULL pointer.
This bug has also been pointed out in bash 1.02 and the following
patch is sanctioned by the writer of bash.  It can be applied to
readline.c for gdb and bash both:

*** readline.c.orig	Thu Jul 13 14:11:18 1989
--- readline.c	Thu Jul 13 14:06:24 1989
***************
*** 3794,3800 ****
  {
    register int i;
  
!   for (i = 0; funmap[i]->name; i++)
      if (stricmp (funmap[i]->name, string) == 0)
        return (funmap[i]->function);
    return ((Function *)NULL);
--- 3794,3800 ----
  {
    register int i;
  
!   for (i = 0; funmap[i]; i++)
      if (stricmp (funmap[i]->name, string) == 0)
        return (funmap[i]->function);
    return ((Function *)NULL);
--

Andrew Thomas
andrewt@watsnew.waterloo.edu	Systems Design Eng.	University of Waterloo
"If a million people do a stupid thing, it's still a stupid thing." - Opus