diff options
author | Luis Machado <luis.machado@linaro.org> | 2021-12-15 12:18:35 -0300 |
---|---|---|
committer | Luis Machado <luis.machado@linaro.org> | 2021-12-20 10:54:49 -0300 |
commit | 006af8691a7ec725ab3b269a99f34862b2d69d55 (patch) | |
tree | aabdd99d9466c1f06540b6ec7d24bb645e946ddd | |
parent | 3904c2a5518b6616a4b4b53e3525fa54a6838f16 (diff) | |
download | gdb-006af8691a7ec725ab3b269a99f34862b2d69d55.zip gdb-006af8691a7ec725ab3b269a99f34862b2d69d55.tar.gz gdb-006af8691a7ec725ab3b269a99f34862b2d69d55.tar.bz2 |
Fix segfault when creating builtin types
Sanity check the existence of a type field before dereferencing it.
-rw-r--r-- | gdb/gdbtypes.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 06f42a10..b83cfb8 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5732,8 +5732,9 @@ append_composite_type_field_raw (struct type *t, const char *name, f[0].set_type (field); FIELD_NAME (f[0]) = name; - if (field->contains_capability () - || field->code () == TYPE_CODE_CAPABILITY) + if (field != nullptr + && (field->contains_capability () + || field->code () == TYPE_CODE_CAPABILITY)) t->set_contains_capability (true); return f; |