mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-22 09:46:37 +08:00
libctf: error out on corrupt CTF with invalid header flags
If corrupt CTF with invalid header flags is passed in, return the new error ECTF_FLAGS. include/ * ctf-api.h (ECTF_FLAGS): New. (ECTF_NERR): Adjust. * ctf.h (CTF_F_MAX): New. libctf/ * ctf-open.c (ctf_bufopen_internal): Diagnose invalid flags.
This commit is contained in:
@ -1384,6 +1384,9 @@ ctf_bufopen_internal (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect,
|
||||
if (pp->ctp_version < CTF_VERSION_3)
|
||||
hdrsz = sizeof (ctf_header_v2_t);
|
||||
|
||||
if (_libctf_unlikely_ (pp->ctp_flags > CTF_F_MAX))
|
||||
return (ctf_set_open_errno (errp, ECTF_FLAGS));
|
||||
|
||||
if (ctfsect->cts_size < hdrsz)
|
||||
return (ctf_set_open_errno (errp, ECTF_NOCTFBUF));
|
||||
|
||||
|
Reference in New Issue
Block a user