aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-04-16 12:12:09 -0600
committerTom Tromey <tromey@adacore.com>2019-04-17 06:55:05 -0600
commita12e57448ecf2644e3ddc98bbd4bbb914a5f8c92 (patch)
tree9f2cfe0d210dfcafd777128ba950e1a2f5eea25b /gdb/dwarf2read.c
parenta7e559cc087b10b9ea337b58e52cc13964aae3fb (diff)
downloadfsf-binutils-gdb-a12e57448ecf2644e3ddc98bbd4bbb914a5f8c92.zip
fsf-binutils-gdb-a12e57448ecf2644e3ddc98bbd4bbb914a5f8c92.tar.gz
fsf-binutils-gdb-a12e57448ecf2644e3ddc98bbd4bbb914a5f8c92.tar.bz2
Avoid crash in dwarf2_init_complex_target_type
After commit 35add35 ("gdb: Fix failure in gdb.base/complex-parts.exp for x86-32"), dwarf2_init_complex_target_type can crash if "tt" is nullptr. This patch avoids the problem by checking for this case. No test case because I don't know a good way to write one; it was found by an internal AdaCore test case that apparently uses a 16 bit floating point type. gdb/ChangeLog: * dwarf2read.c (dwarf2_init_complex_target_type): Check "tt" against nullptr before use. gdb/ChangeLog 2019-04-17 Tom Tromey <tromey@adacore.com> * dwarf2read.c (dwarf2_init_complex_target_type): Check "tt" against nullptr before use.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0873028..16bf240 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17566,7 +17566,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
/* If the type we found doesn't match the size we were looking for, then
pretend we didn't find a type at all, the complex target type we
create will then be nameless. */
- if (TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
+ if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
tt = nullptr;
const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);