From: Gary Benson Date: Thu, 9 Feb 2017 15:35:33 +0000 (+0000) Subject: Fix NULL pointer dereference X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff6fa24786eb2c03c1af95e2559fa3fd0b2f3893;p=binutils-gdb.git Fix NULL pointer dereference 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2792509243e..318dbaf23d3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-02-09 Gary Benson + + * symtab.c (add_symtab_completions): Prevent NULL pointer + dereference. + 2017-02-08 Pedro Alves * interps.c (interp::interp): Remove reference to quiet_p. diff --git a/gdb/symtab.c b/gdb/symtab.c index 356f480bb88..2c141e5a59d 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;