diff options
author | Alan Modra <amodra@gmail.com> | 2017-07-03 22:00:32 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-07-03 22:03:49 +0930 |
commit | 19871f45ddfa7681f8f7585e73409f4fe5b51258 (patch) | |
tree | 6e22a3de83c92771f71e51f211f9c0dbb66d2421 /ld | |
parent | 76cfced5addbd827652688a13f9cfa02afce51a5 (diff) | |
download | gdb-19871f45ddfa7681f8f7585e73409f4fe5b51258.zip gdb-19871f45ddfa7681f8f7585e73409f4fe5b51258.tar.gz gdb-19871f45ddfa7681f8f7585e73409f4fe5b51258.tar.bz2 |
strings: remove section/file size check
This reverts most of 06803313754, 2005-07-05 Dmitry V. Levin change
adding a check that section size doesn't exceed file size. As we've
seen recently with mmo tests, decoded section size can easily exceed
file size with formats that encode section data.
I've also changed "strings" to use bfd_malloc_and_get_section, so that
"strings" won't die on a malloc failure. I think it's better to
continue on looking at other sections after failing to dump a section
with fuzzed size.
The testcases at https://bugzilla.altlinux.org/show_bug.cgi?id=5871
on a 32-bit host now produce
$ strings -d --target=a.out-i386 /tmp/bfdkiller.dat
strings: error: /tmp/bfdkiller.dat(.text) is too large (0xffffffff bytes)
strings: /tmp/bfdkiller.dat: Reading section .text failed: Memory exhausted
strings: /tmp/bfdkiller.dat: Reading section .data failed: File truncated
org.ec
$ strings -d --target=a.out-i386 /tmp/eclipse-state
strings: /tmp/eclipse-state: Reading section .text failed: File truncated
org.eclipse.osgi
System Bundle
[snip]
* strings.c (filename_and_size_t): Delete.
(strings_a_section): Don't check section size against file size.
Use bdf_malloc_and_get_section. Report an error on failures.
Replace arg param with filename and got_a_section param.
(got_a_section): Move to..
(strings_object_file): ..an auto var here. Iterate over sections
rather than calling bfd_map_over_sections. Adjust strings_a_section
call.
Diffstat (limited to 'ld')
0 files changed, 0 insertions, 0 deletions