Signed-off-by: Mark Wielaard <[email protected]>
---
 libdw/ChangeLog |    5 +++++
 libdw/fde.c     |    6 +++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index c8398b2..1a85194 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-12  Mark Wielaard  <[email protected]>
+
+       * fde.c (intern_fde): Free fde and set libdw errno when start
+       or end could not be read.
+
 2013-08-24  Mark Wielaard  <[email protected]>
 
        * dwarf_getlocation.c (store_implicit_value): Don't take data
diff --git a/libdw/fde.c b/libdw/fde.c
index 32c77b0..91ce732 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;
-- 
1.7.1

Reply via email to