diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-17 21:09:31 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-19 22:19:19 +1030 |
commit | 027333da75744bd27e6f05e58ac625f5bf450c8a (patch) | |
tree | 2b131d8b121a1e006830eb4b3b5881f211c7532d /libctf/ctf-open.c | |
parent | 52435e5ff6cc9f00841ad6a8db701917904de4ed (diff) | |
download | gdb-027333da75744bd27e6f05e58ac625f5bf450c8a.zip gdb-027333da75744bd27e6f05e58ac625f5bf450c8a.tar.gz gdb-027333da75744bd27e6f05e58ac625f5bf450c8a.tar.bz2 |
ctf segfaults
PR 30228
PR 30229
* ctf-open.c (ctf_bufopen_internal): Check for NULL cts_data.
* ctf-archive.c (ctf_arc_bufpreamble, ctf_arc_bufopen): Likewise.
Diffstat (limited to 'libctf/ctf-open.c')
-rw-r--r-- | libctf/ctf-open.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 5bcf0dd..35f635b 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1354,7 +1354,8 @@ ctf_bufopen_internal (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect, if (strsect != NULL && strsect->cts_data == NULL) return (ctf_set_open_errno (errp, ECTF_STRBAD)); - if (ctfsect->cts_size < sizeof (ctf_preamble_t)) + if (ctfsect->cts_data == NULL + || ctfsect->cts_size < sizeof (ctf_preamble_t)) return (ctf_set_open_errno (errp, ECTF_NOCTFBUF)); pp = (const ctf_preamble_t *) ctfsect->cts_data; |