summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@myware66.akkadia.org>2009-02-10 12:55:07 -0800
committerUlrich Drepper <drepper@myware66.akkadia.org>2009-02-10 12:55:07 -0800
commita9d51bfe57609a2623ba4c626454456c4310bec9 (patch)
tree35429d6091c1a97a7e27bca181b8dc7966d07406
parent973a9c7c91b8bb0ace3f896d3b543dfa5466f27f (diff)
downloadelfutils-a9d51bfe57609a2623ba4c626454456c4310bec9.tar.gz
Fix crash in libdw with empty input files.
-rw-r--r--libdwfl/ChangeLog4
-rw-r--r--libdwfl/open.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index aafa1c92..ba946c28 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -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
diff --git a/libdwfl/open.c b/libdwfl/open.c
index 611295f2..0ab2a9d2 100644
--- a/libdwfl/open.c
+++ b/libdwfl/open.c
@@ -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)