aboutsummaryrefslogtreecommitdiff
path: root/bfd/ieee.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-11-14 12:30:00 +0000
committerNick Clifton <nickc@redhat.com>2014-11-14 12:30:00 +0000
commit041830e03cca866f12be18198898139e558ad31e (patch)
tree343e78caf87d119aa29bb7ea3d471260d1296370 /bfd/ieee.c
parent646da0594c91719ef591d8736865a1d58fbbfc34 (diff)
downloadfsf-binutils-gdb-041830e03cca866f12be18198898139e558ad31e.zip
fsf-binutils-gdb-041830e03cca866f12be18198898139e558ad31e.tar.gz
fsf-binutils-gdb-041830e03cca866f12be18198898139e558ad31e.tar.bz2
More fixes for invalid memory accesses triggered by corrupt binaries.
PR binutils/17512 * dwarf.c (get_encoded_value): Add an 'end' parameter. Change the 'data' parameter to a double pointer and return the updated value. (decode_location_expression): Update call to get_encoded_value. (frame_need_space): Handle the case where one or both of the mallocs fails. (read_cie): Initialise the cie pointer, even if the read fails. (display_debug_frames): Warn if the calculated block_end is before the start of the block. Break the loop if the CIE could not be read. Update call to get_encoded_value. Warn if the read CFA expressions are too big. * ieee.c (ieee_archive_p) Skip processing if no bytes are read at all. (ieee_object_p): Likewise.
Diffstat (limited to 'bfd/ieee.c')
-rw-r--r--bfd/ieee.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 256e8f6..313834e 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -1312,7 +1312,8 @@ ieee_archive_p (bfd *abfd)
/* Ignore the return value here. It doesn't matter if we don't read
the entire buffer. We might have a very small ieee file. */
- bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ if (bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd) <= 0)
+ goto got_wrong_format_error;
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
@@ -1801,7 +1802,8 @@ ieee_object_p (bfd *abfd)
goto fail;
/* Read the first few bytes in to see if it makes sense. Ignore
bfd_bread return value; The file might be very small. */
- bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
+ if (bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd) <= 0)
+ goto got_wrong_format;
ieee->h.input_p = buffer;
if (this_byte_and_next (&(ieee->h)) != Module_Beginning)