]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Don't use a FDE if it doesn't actually cover a real code range.
authorMark Wielaard <mjw@redhat.com>
Tue, 1 Dec 2015 23:21:07 +0000 (00:21 +0100)
committerMark Wielaard <mjw@redhat.com>
Sat, 2 Jan 2016 19:37:45 +0000 (20:37 +0100)
If the FDE end <= start then it doesn't actually cover a valid code range.
Don't use and cache such FDEs (it will cause memory leaks if there is
another FDE that has the same start address and a valid code range).

Such FDEs have been seen in the backtrace.ppc.exec testfile.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdw/ChangeLog
libdw/fde.c

index b176ade6f4d3d275ce34a09c7382072314f58baf..738e2236dac1ac3cefd36be054c968c7680a061b 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-01  Mark Wielaard  <mjw@redhat.com>
+
+       * fde.c (intern_fde): Don't intern an fde that doesn't cover a
+       valid code range.
+
 2015-12-01  Mark Wielaard  <mjw@redhat.com>
 
        * dwarf_end.c (dwarf_end): Call cu_free on fake_loc_cu if it exists.
index c8475f3e6db9604487b347f470787379d4bbc95b..2a59d3e12e275aadffd90d29639897608076d24e 100644 (file)
@@ -90,6 +90,13 @@ intern_fde (Dwarf_CFI *cache, const Dwarf_FDE *entry)
     }
   fde->end += fde->start;
 
+  /* Make sure the fde actually covers a real code range.  */
+  if (fde->start >= fde->end)
+    {
+      free (fde);
+      return (void *) -1;
+    }
+
   fde->cie = cie;
 
   if (cie->sized_augmentation_data)