[OB PATCH] Fix NULL pointer dereference

Gary Benson gbenson@redhat.com
Thu Feb 9 15:39:00 GMT 2017


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 | 5 +++++
 gdb/symtab.c  | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 356f480..2c141e5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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;
-- 
1.8.3.1



More information about the Gdb-patches mailing list