Skip to content

fuzz: Fix wallet_bdb_parser 32-bit unhandled fseek error - #30307

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
maflcko:2406-fuzz-wallet-bdb-32
Jun 20, 2024
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
maflcko:2406-fuzz-wallet-bdb-32

Conversation

@maflcko

@maflcko maflcko commented Jun 19, 2024 •

Copy link
Copy Markdown
Member

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.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69414

@DrahtBot

DrahtBot commented Jun 19, 2024 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

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.

@DrahtBot DrahtBot added the Tests label Jun 19, 2024
@maflcko
maflcko force-pushed the 2406-fuzz-wallet-bdb-32 branch from fae0541 to fa7bc9b Compare June 19, 2024 11:39
@maflcko

maflcko commented Jun 19, 2024

Copy link
Copy Markdown
Member Author

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)

@sedited sedited left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fa7bc9b

@brunoerg brunoerg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK fa7bc9b

@fanquake
fanquake merged commit aa2ce2d into bitcoin:master Jun 20, 2024
@maflcko
maflcko deleted the 2406-fuzz-wallet-bdb-32 branch June 20, 2024 08:54
@bitcoin bitcoin locked and limited conversation to collaborators Jun 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants