If a Dwarf_Die was requested from an offset into a section data that
didn't exist we would crash. Crashing is bad even if given bad input.
Just return an error in that case.
Signed-off-by: Mark Wielaard <mark@klomp.org>
+2017-12-28 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_offdie.c (__libdw_offdie): Check sectiondata exists.
+
2017-05-09 Ulf Hermann <ulf.hermann@qt.io>
Mark Wielaard <mark@klomp.org>
/* Return DIE at given offset.
- Copyright (C) 2002-2010 Red Hat, Inc.
+ Copyright (C) 2002-2010, 2017 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
Elf_Data *const data = dbg->sectiondata[debug_types ? IDX_debug_types
: IDX_debug_info];
- if (offset >= data->d_size)
+ if (data == NULL || offset >= data->d_size)
{
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return NULL;