diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2018-11-06 19:55:21 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2018-11-07 12:58:56 +0000 |
commit | 35ee2dc2e4de8b1ae73f420d5db3375f92300b70 (patch) | |
tree | 0e3bf62a6485e3d8d9345ed6d3a404919ab43076 /include | |
parent | 42d4c301c45df41d1c724b7b86f8683a875c010a (diff) | |
download | gdb-35ee2dc2e4de8b1ae73f420d5db3375f92300b70.zip gdb-35ee2dc2e4de8b1ae73f420d5db3375f92300b70.tar.gz gdb-35ee2dc2e4de8b1ae73f420d5db3375f92300b70.tar.bz2 |
gdb: Guard against NULL dereference in dwarf2_init_integer_type
In this commit:
commit eb77c9df9f6d2f7aa644a170280fe31ce080f887
Date: Thu Oct 18 14:04:27 2018 +0100
gdb: Handle ICC's unexpected void return type
A potential dereference of a NULL pointer was introduced if a
DW_TAG_base_type is missing a DW_AT_name attribute.
I have taken this opportunity to fix a slight confusion that existed
in the test also added in the above commit, the test had two C
variables, declared like this:
int var_a = 5;
void *var_ptr = &var_a;
However, the fake DWARF in the test script declared them like this:
void var_a = 5;
void *var_ptr = &var_a;
This wasn't a problem as the test never uses 'var_a' directly, this
only exists so 'var_ptr' can be initialised. However, it seemed worth
fixing.
I've also added a test for a DW_TAG_base_type with a missing
DW_AT_name, as clearly there's not test currently that covers this
(the original patch tested cleanly). I can confirm that the new test
causes GDB to crash before this patch, and passes with this patch.
gdb/ChangeLog:
* dwarf2read.c (dwarf2_init_integer_type): Check for name being
NULL before dereferencing it.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/void-type.exp: Rename types, and make var_a an 'int'.
* gdb.dwarf2/missing-type-name.exp: New file.
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions