Fix access to uninitialized variable in fill_in_stop_func
authorPedro Franco de Carvalho <pedromfc@linux.ibm.com>
Fri, 9 Aug 2019 19:49:46 +0000 (16:49 -0300)
committerPedro Franco de Carvalho <pedromfc@linux.ibm.com>
Fri, 9 Aug 2019 19:49:46 +0000 (16:49 -0300)
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:
2019-08-09  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* blockframe.c (find_pc_partial_function): Set *block to nullptr
when the function fails.

gdb/ChangeLog
gdb/blockframe.c

index 00e4bac..4008783 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-09  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
+
+       * blockframe.c (find_pc_partial_function): Set *block to nullptr
+       when the function fails.
+
 2019-08-09  Andreas Arnez  <arnez@linux.ibm.com>
 
        * s390-tdep.c (s390_type_align): New function.
index fe7807b..4462274 100644 (file)
@@ -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;
     }