From: Mark Wielaard Date: Thu, 12 Sep 2013 13:49:47 +0000 (+0200) Subject: Fix memory leak and set libdw errno when intern_fde cannot parse start/end. X-Git-Tag: elfutils-0.157~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18b2c67fa2a422c744efba0d4c9a8cb9ef423823;p=thirdparty%2Felfutils.git Fix memory leak and set libdw errno when intern_fde cannot parse start/end. Signed-off-by: Mark Wielaard --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index c8398b231..1a8519489 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2013-09-12 Mark Wielaard + + * fde.c (intern_fde): Free fde and set libdw errno when start + or end could not be read. + 2013-08-24 Mark Wielaard * dwarf_getlocation.c (store_implicit_value): Don't take data diff --git a/libdw/fde.c b/libdw/fde.c index 32c77b0d9..91ce7327a 100644 --- a/libdw/fde.c +++ b/libdw/fde.c @@ -83,7 +83,11 @@ intern_fde (Dwarf_CFI *cache, const Dwarf_FDE *entry) &fde->instructions, &fde->start)) || unlikely (read_encoded_value (cache, cie->fde_encoding & 0x0f, &fde->instructions, &fde->end))) - return NULL; + { + free (fde); + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } fde->end += fde->start; fde->cie = cie;