-
Notifications
You must be signed in to change notification settings - Fork 37.7k
tests: Add fuzzing harness testing the locale independence of the strencodings.h functions #18126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
680f630
to
fbd1d58
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
599bfb9
to
bce60a7
Compare
beee4af
to
4a9d6a6
Compare
4a9d6a6
to
259e290
Compare
Rebased! :) |
The OP says "all call locale dependent functions", the title says "locale independence". Which is correct? What is the point of a test that tests the functions are not locale independent? |
@MarcoFalke They all call functions that are known to be locale dependent (see list in lint-locale-dependence.sh) but they are supposed to do so in a way that guarantees that their own output is locale independent. Does that answer your question? :) |
This has broken Travis: Run locale with args ['valgrind', '--quiet', '--error-exitcode=1', '/home/travis/build/bitcoin/bitcoin/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/locale', '-runs=1', '/home/travis/build/bitcoin/bitcoin/ci/scratch//qa-assets/fuzz_seed_corpus/locale']
Output: INFO: Seed: 818858521
INFO: Loaded 1 modules (1402 inline 8-bit counters): 1402 [0x3a7c40, 0x3a81ba),
INFO: Loaded 1 PC tables (1402 PCs): 1402 [0x3a81c0,0x3ad960),
No such file or directory: /home/travis/build/bitcoin/bitcoin/ci/scratch//qa-assets/fuzz_seed_corpus/locale; exiting
INFO: Seed: 818858521
INFO: Loaded 1 modules (1402 inline 8-bit counters): 1402 [0x3a7c40, 0x3a81ba),
INFO: Loaded 1 PC tables (1402 PCs): 1402 [0x3a81c0,0x3ad960),
No such file or directory: /home/travis/build/bitcoin/bitcoin/ci/scratch//qa-assets/fuzz_seed_corpus/locale; exiting
Target "locale" failed with exit code 1: valgrind --quiet --error-exitcode=1 /home/travis/build/bitcoin/bitcoin/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/locale -runs=1 /home/travis/build/bitcoin/bitcoin/ci/scratch//qa-assets/fuzz_seed_corpus/locale I assume seeds just need to be added to https://github.com/bitcoin-core/qa-assets? |
…d unbreak Travis! :)) 0d0bc3b build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift) Pull request description: Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`. This is a follow-up to #18126 which broke Travis. Sorry about that :) ACKs for top commit: fanquake: ACK 0d0bc3b Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
…ORA (and unbreak Travis! :)) 0d0bc3b build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift) Pull request description: Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`. This is a follow-up to bitcoin#18126 which broke Travis. Sorry about that :) ACKs for top commit: fanquake: ACK 0d0bc3b Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
Summary: ``` Context: C and C++ locale assumptions in bitcoind and bitcoin-qt Add fuzzing harness for locale independence testing of functions in strencodings.h and tinyformat.h. ``` Backport of core [[bitcoin/bitcoin#18126 | PR18126]]. Test Plan: ninja bitcoin-fuzzers ./test/fuzz/test_runner.py <path_to_corpus> Reviewers: #bitcoin_abc, PiRK Reviewed By: PiRK Differential Revision: https://reviews.bitcoinabc.org/D8251
…ORA (and unbreak Travis! :)) 0d0bc3b build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift) Pull request description: Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`. This is a follow-up to bitcoin#18126 which broke Travis. Sorry about that :) ACKs for top commit: fanquake: ACK 0d0bc3b Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
…ORA (and unbreak Travis! :)) 0d0bc3b build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift) Pull request description: Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`. This is a follow-up to bitcoin#18126 which broke Travis. Sorry about that :) ACKs for top commit: fanquake: ACK 0d0bc3b Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
…ORA (and unbreak Travis! :)) 0d0bc3b build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift) Pull request description: Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`. This is a follow-up to bitcoin#18126 which broke Travis. Sorry about that :) ACKs for top commit: fanquake: ACK 0d0bc3b Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
…ORA (and unbreak Travis! :)) 0d0bc3b build: Add locale fuzzer to FUZZERS_MISSING_CORPORA (practicalswift) Pull request description: Add `locale` fuzzer to `FUZZERS_MISSING_CORPORA`. This is a follow-up to bitcoin#18126 which broke Travis. Sorry about that :) ACKs for top commit: fanquake: ACK 0d0bc3b Tree-SHA512: c0968dc798839f87c891d1dfccf5541883ac56b51a29f52244e78c221c9c087d2dea0a959612d907d53b29fca1f486b340227b17653227ecbf6ca5ab0e85b0d3
Context: C and C++ locale assumptions in bitcoind and bitcoin-qt
Add fuzzing harness for locale independence testing of functions in
strencodings.h
andtinyformat.h
.Test this PR using:
The tested functions (
ParseInt32(…)
,ParseInt64(…)
,atoi(const std::string&)
,atoi64(const std::string& str)
,i64tostr(const char*)
,itostr(…)
,strprintf(…)
) all call locale dependent functions (such asstrtol(…)
,strtoll(…)
,atoi(const char*)
, etc.) but are assumed to do so in a way that the tested functions return same results regardless of the chosen C locale (setlocale
).This fuzzer aims to test that those assumptions hold up also in practice now and over time.