mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-18 17:24:31 -04:00
libdw: Make sure there is enough space to read offset in dwarf_getpubnames.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2014-12-16 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* dwarf_getpubnames.c (dwarf_getpubnames): Make sure there is enough
|
||||
space to read die offset.
|
||||
|
||||
2014-12-16 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* dwarf_getsrclines.c (read_srclines): Correct overflow check for
|
||||
|
||||
@@ -199,6 +199,8 @@ dwarf_getpubnames (dbg, callback, arg, offset)
|
||||
while (1)
|
||||
{
|
||||
/* READP points to the next offset/name pair. */
|
||||
if (readp + dbg->pubnames_sets[cnt].address_len > endp)
|
||||
goto invalid_dwarf;
|
||||
if (dbg->pubnames_sets[cnt].address_len == 4)
|
||||
gl.die_offset = read_4ubyte_unaligned_inc (dbg, readp);
|
||||
else
|
||||
@@ -215,6 +217,7 @@ dwarf_getpubnames (dbg, callback, arg, offset)
|
||||
readp = (unsigned char *) memchr (gl.name, '\0', endp - readp);
|
||||
if (unlikely (readp == NULL))
|
||||
{
|
||||
invalid_dwarf:
|
||||
__libdw_seterrno (DWARF_E_INVALID_DWARF);
|
||||
return -1l;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user