3 Commits

Author SHA1 Message Date
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
90a9975712
Move some fuzz targets over to testing ElfBytes 2022-11-04 22:24:32 -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