11 Commits

Author SHA1 Message Date
Christopher Cole
5a933389a8
Add fuzz/coverage/ to .gitignore
These are generated coverage report files from `cargo fuzz coverage ...`
2022-11-13 19:06:41 -08:00
Christopher Cole
ea3605ed29
Simplify the notes fuzz target to just fuzz note parsing
The other ElfBytes logic is fuzzed elsewhere - this simplifies the fuzz
target space to get more coverage of the notes parsing specifics.
2022-11-13 17:24:26 -08:00
Christopher Cole
9a6a265afc
Rename CommonElfSections -> CommonElfData
These aren't only found in sections, so I felt "Data" fit better as a name here
2022-11-12 13:37:09 -08:00
Christopher Cole
2faf0ca1b0
Update common fuzz target for hash table change
Also, fuzz the gnu_hash table
2022-11-09 19:44:23 -08:00
Christopher Cole
b53237960b
Fix OOM in ElfStream parsing when parsing corrupted files
When parsing invalid ELF data with ranges larger than actual file size, CachedReader would
eagerly allocate a buffer to land the read of that huge size even though the read would later fail.
This could cause unbounded vec allocations.

CachedReader now seeks to find the actual stream lengthh at the beginning and validates read requests
against that.

Also, add fuzz testing for some basic ElfStream interfaces (that's what caught this bug).
Also, rustfmt the fuzz targets.
2022-11-05 18:40:58 -07:00
Christopher Cole
40240fc4af
Fix a divide by zero panic in SysVHashTable.find() for empty tables
Also, add fuzz coverage for ElfBytes::find_common_sections() and its
associated types. This fuzzing is what discovered that panic in find().
2022-11-05 14:18:58 -07:00
Christopher Cole
40799c6961
Add ElfBytes::symbol_version_table() to get the GNU extension symbol version table. 2022-11-05 13:39:02 -07:00
Christopher Cole
6d6d1e23ce
Rename elf::File -> elf::ElfStream and make it specific to the Read + Seek interface 2022-11-04 23:04:25 -07:00
Christopher Cole
90a9975712
Move some fuzz targets over to testing ElfBytes 2022-11-04 22:24:32 -07:00
Christopher Cole
133fa08114
Rename gabi -> abi since it technically includes extension constants, too 2022-11-04 16:43:13 -07:00
Christopher Cole
848f648996
Add some fuzz targets for some parts of our ELF parsing interface via cargo-fuzz
I decided to make multiple smaller fuzz targets like this in order to give each one
a smaller fuzzing domain to explore for that particular feature.
2022-11-01 12:14:15 -07:00