Fix crash in libdw with empty input files.
authorUlrich Drepper <drepper@myware66.akkadia.org>
Tue, 10 Feb 2009 20:55:07 +0000 (12:55 -0800)
committerUlrich Drepper <drepper@myware66.akkadia.org>
Tue, 10 Feb 2009 20:55:07 +0000 (12:55 -0800)
libdwfl/ChangeLog
libdwfl/open.c

index aafa1c9..ba946c2 100644 (file)
@@ -1,3 +1,7 @@
+2009-02-10  Ulrich Drepper  <drepper@redhat.com>
+
+       * open.c (decompress): Avoid crash with empty input file.
+
 2009-01-27  Roland McGrath  <roland@redhat.com>
 
        * dwfl_report_elf.c (__libdwfl_report_elf): Ignore trailing PT_LOAD
index 611295f..0ab2a9d 100644 (file)
@@ -75,6 +75,8 @@ decompress (int fd __attribute__ ((unused)), Elf **elf)
   void *const mapped = ((*elf)->map_address == NULL ? NULL
                        : (*elf)->map_address + (*elf)->start_offset);
   const size_t mapped_size = (*elf)->maximum_size;
+  if (mapped_size == 0)
+    return error;
 
   error = __libdw_gunzip (fd, offset, mapped, mapped_size, &buffer, &size);
   if (error == DWFL_E_BADELF)