]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't assert if the DWARF line info reader is given so little data that
authorTom Hughes <tom@compton.nu>
Thu, 20 Oct 2005 18:38:08 +0000 (18:38 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 20 Oct 2005 18:38:08 +0000 (18:38 +0000)
it can't even read the length of the block - just report an error as we
do if there isn't enough data for the rest of the block. Fix bug #114757.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4960

coregrind/m_debuginfo/dwarf.c

index e2794c7eabfcd5c1cafdd803403ec0e88b8fc289..1d5cc8022a7dffe946f20d6e0a0635ebd870b3d7 100644 (file)
@@ -408,8 +408,6 @@ void read_dwarf2_lineblock ( SegInfo*  si,
              == sizeof(DWARF2_Internal_LineInfo));
    */
 
-   vg_assert(noLargerThan > 0);
-
    init_WordArray(&filenames);
    init_WordArray(&dirnames);
    init_WordArray(&fnidx2dir);
@@ -431,6 +429,12 @@ void read_dwarf2_lineblock ( SegInfo*  si,
 
    external = (DWARF2_External_LineInfo *) data;
 
+   if (sizeof (external->li_length) > noLargerThan) {
+      ML_(symerr)("DWARF line info appears to be corrupt "
+                  "- the section is too small");
+      goto out;
+   }
+
    /* Check the length of the block.  */
    info.li_length = * ((UInt *)(external->li_length));