This exposes a bug in dwarf_formstring as detected by the dwarf-getmacros
test before we made sure to use the correct sec_idx for the CU.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
+2017-05-09 Ulf Hermann <ulf.hermann@qt.io>
+ Mark Wielaard <mark@klomp.org>
+
+ * libdwP.h (__libdw_in_section): Fix check for the upper border of
+ the range.
+ (__libdw_offset_in_section): Likewise.
+
2017-12-20 Mark Wielaard <mark@klomp.org>
* libdwP.h (struct Dwarf_CU): Add sec_idx field.
if (data == NULL)
return -1;
if (unlikely (offset > data->d_size)
- || unlikely (data->d_size - offset < size))
+ || unlikely (data->d_size < size)
+ || unlikely (offset > data->d_size - size))
{
__libdw_seterrno (DWARF_E_INVALID_OFFSET);
return -1;
if (data == NULL)
return false;
if (unlikely (addr < data->d_buf)
- || unlikely (data->d_size - (addr - data->d_buf) < size))
+ || unlikely (data->d_size < size)
+ || unlikely ((size_t)(addr - data->d_buf) > data->d_size - size))
{
__libdw_seterrno (DWARF_E_INVALID_OFFSET);
return false;