Fix NULL pointer dereference
authorGary Benson <gbenson@redhat.com>
Thu, 9 Feb 2017 15:35:33 +0000 (15:35 +0000)
committerGary Benson <gbenson@redhat.com>
Thu, 9 Feb 2017 15:37:57 +0000 (15:37 +0000)
This commit fixes a segmentation fault on tab completion when
certain debuginfo is installed:

  https://bugzilla.redhat.com/show_bug.cgi?id=1398387

gdb/ChangeLog:

* symtab.c (add_symtab_completions): Prevent NULL pointer
dereference.

gdb/ChangeLog
gdb/symtab.c

index 2792509243e6b003b48a782ea07826634e74b04b..318dbaf23d3aab6d47094555bd4125aca26c34b0 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-09  Gary Benson  <gbenson@redhat.com>
+
+       * symtab.c (add_symtab_completions): Prevent NULL pointer
+       dereference.
+
 2017-02-08  Pedro Alves  <palves@redhat.com>
 
        * interps.c (interp::interp): Remove reference to quiet_p.
index 356f480bb889a365b9b79862a568b3468fda3b04..2c141e5a59d51f22dce5762ffb0085a15b10ae68 100644 (file)
@@ -5163,6 +5163,9 @@ add_symtab_completions (struct compunit_symtab *cust,
   struct block_iterator iter;
   int i;
 
+  if (cust == NULL)
+    return;
+
   for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
     {
       QUIT;