std::fseek on 64-bit past the end of the file may work fine (the following read would fail). However, on 32-bit it may fail early.
Fix it, by ignoring the error, treating it similar to a read error.
This was found by OSS-Fuzz.
std::fseek on 64-bit past the end of the file may work fine (the following read would fail). However, on 32-bit it may fail early.
Fix it, by ignoring the error, treating it similar to a read error.
This was found by OSS-Fuzz.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| ACK | TheCharlatan, brunoerg |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Example:
$ base64 ~/Downloads/clusterfuzz-testcase-minimized-wallet_bdb_parser-5937261974716416
ICD//yAgICAAAAAAAAUxYgAAAAkAAAIAAAkgICAgICAAAAAAICAgICAgICAgICAgAAAAIP//ICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICD/ICAgICAg////////ICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAg////ICD//yAgICAgICAgICAgICAgICAgICAg////////
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg////ICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIP///yAgICAg
ICAgICAg////IP//////ICAgICAgICAg//8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICD///8g//////8gICAgICAgICD//yAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg////ICAgIP//IP//////ICAgICAg
ICAg//8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA=
To test locally:
CONFIG_SITE="$PWD/depends/i686-pc-linux-gnu/share/config.site" ./configure --enable-fuzz --with-sanitizers=fuzzer && make clean && make -j $(nproc)
FUZZ=wallet_bdb_parser ./src/test/fuzz/fuzz -runs=1 /tmp/c
Before:
terminate called after throwing an instance of 'std::runtime_error'
what(): AutoFile::seek: fseek failed: iostream error
After:
(Passes)
ACK fa7bc9bbca9348cf31b97bee0789ea7caeec635c
utACK fa7bc9bbca9348cf31b97bee0789ea7caeec635c