]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: dwarf_getpubnames set error to DWARF_E_NO_ENTRY for zero entries.
authorMark Wielaard <mjw@redhat.com>
Mon, 15 Dec 2014 15:56:49 +0000 (16:56 +0100)
committerMark Wielaard <mjw@redhat.com>
Wed, 17 Dec 2014 15:46:45 +0000 (16:46 +0100)
realloc in get_offsets will return NULL otherwise and dwarf_getpubnames
might think there was no issue and try to use that NULL pointer.

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

index 068d452123442a1035838b0c44e938fd5dd79e4c..f1f7b1d16b21312d32ad8b62627ad1f0866ca1e8 100644 (file)
@@ -1,7 +1,7 @@
 2014-12-15  Mark Wielaard  <mjw@redhat.com>
 
        * dwarf_getpubnames.c (get_offsets): Make sure whole unit fall inside
-       section data.
+       section data. Set error to DWARF_E_NO_ENTRY if cnt is zero.
        (dwarf_getpubnames): Make sure section data contains string zero
        terminator.
 
index c8b9f9f6c0d3d53f5e0ecf8f948210f6d5a6754c..9fbfcbf3d16f10b8056274ca732dbfe354a87919 100644 (file)
@@ -125,7 +125,7 @@ get_offsets (Dwarf *dbg)
       readp += len;
     }
 
-  if (mem == NULL)
+  if (mem == NULL || cnt == 0)
     {
       __libdw_seterrno (DWARF_E_NO_ENTRY);
       return -1;