[PATCH] Fix access to uninitialized variable in fill_in_stop_func

Pedro Franco de Carvalho pedromfc@linux.ibm.com
Fri Aug 9 19:13:00 GMT 2019


This patch changes find_pc_partial_function so that *block is set to
nullptr when it fails, so that fill_in_stop_func won't access an
uninitialized variable.

gdb/ChangeLog:
YYYY-MM-DD  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

	* blockframe.c (find_pc_partial_function): Set *block to nullptr
          when the function fails.
---
 gdb/blockframe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index fe7807b87a..4462274f46 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -331,6 +331,8 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
 	*address = 0;
       if (endaddr != NULL)
 	*endaddr = 0;
+      if (block != nullptr)
+	*block = nullptr;
       return 0;
     }
 
-- 
2.20.1



More information about the Gdb-patches mailing list