+2015-01-04 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_siblingof.c (dwarf_siblingof): Check sibling attribute
+ is after current DIE.
+
2015-01-04 Mark Wielaard <mjw@redhat.com>
* cfi.c (enough_registers): Check reg < INT32_MAX / sizeof
/* Return sibling of given DIE.
- Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2003-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
/* Something went wrong. */
return -1;
+ /* The sibling attribute should point after this DIE in the CU.
+ But not after the end of the CU. */
size_t size = sibattr.cu->endp - sibattr.cu->startp;
- if (unlikely (offset >= size))
+ size_t die_off = this_die.addr - this_die.cu->startp;
+ if (unlikely (offset >= size || offset <= die_off))
{
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return -1;