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.
practicalswift force-pushed on Feb 12, 2020
practicalswift force-pushed on Feb 12, 2020
fanquake added the label Tests on Feb 12, 2020
DrahtBot
commented at 6:09 PM on February 12, 2020:
member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
#10443 (Add fee_est tool for debugging fee estimation code by ryanofsky)
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.
practicalswift force-pushed on Feb 15, 2020
practicalswift force-pushed on Feb 15, 2020
practicalswift force-pushed on Feb 18, 2020
DrahtBot added the label Needs rebase on Mar 5, 2020
tests: Add fuzzing harness for locale independence testing259e290db8
practicalswift force-pushed on Mar 6, 2020
practicalswift
commented at 1:45 PM on March 6, 2020:
contributor
Rebased! :)
MarcoFalke
commented at 2:07 PM on March 6, 2020:
member
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?
DrahtBot removed the label Needs rebase on Mar 6, 2020
practicalswift
commented at 3:37 PM on March 6, 2020:
contributor
@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? :)
MarcoFalke merged this on Mar 6, 2020
MarcoFalke closed this on Mar 6, 2020
fanquake
commented at 11:01 PM on March 6, 2020:
member
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-05-02 15:14 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me