diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-03-06 14:31:05 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-03-06 14:31:11 -0500 |
commit | 45cdcd47d99e3af28c82839148b637d31c0b4fc9 (patch) | |
tree | 7c7b479eb080c49ae3abf2db8451fef9249decab /test/lint | |
parent | 97aadf98d0b890e09eff45535fa13a663f27334d (diff) | |
parent | 259e290db8f784dba75979acf16e7964af63445c (diff) | |
download | bitcoin-45cdcd47d99e3af28c82839148b637d31c0b4fc9.tar.xz |
Merge #18126: tests: Add fuzzing harness testing the locale independence of the strencodings.h functions
259e290db8f784dba75979acf16e7964af63445c tests: Add fuzzing harness for locale independence testing (practicalswift)
Pull request description:
Context: [C and C++ locale assumptions in bitcoind and bitcoin-qt](https://github.com/bitcoin/bitcoin/pull/18124)
Add fuzzing harness for locale independence testing of functions in `strencodings.h` and `tinyformat.h`.
Test this PR using:
```
$ make distclean
$ ./autogen.sh
$ CC=clang CXX=clang++ ./configure --enable-fuzz \
--with-sanitizers=address,fuzzer,undefined
$ make
$ src/test/fuzz/locale
…
```
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 as `strtol(…)`, `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.
Top commit has no ACKs.
Tree-SHA512: d108d2f85aa6f482839dafbc7579465ffd4bacf7bc52835ad0fbaa1c71aed9b3870c83447b3d453a03b9ce307e76a3cfdd350a0c77024ab094c93c7d62c8a527
Diffstat (limited to 'test/lint')
-rwxr-xr-x | test/lint/lint-locale-dependence.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/lint/lint-locale-dependence.sh b/test/lint/lint-locale-dependence.sh index 35e58c2df6..0cb38b6fdb 100755 --- a/test/lint/lint-locale-dependence.sh +++ b/test/lint/lint-locale-dependence.sh @@ -22,6 +22,7 @@ KNOWN_VIOLATIONS=( "src/test/blockchain_tests.cpp.*std::to_string" "src/test/dbwrapper_tests.cpp:.*snprintf" "src/test/denialofservice_tests.cpp.*std::to_string" + "src/test/fuzz/locale.cpp" "src/test/fuzz/parse_numbers.cpp:.*atoi" "src/test/key_tests.cpp.*std::to_string" "src/test/net_tests.cpp.*std::to_string" |