mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-31 10:41:08 +00:00
Merge bitcoin/bitcoin#34017: fuzz: Add a test case for ParseByteUnits()
57b888ce0ebdeb34d866fd1511052fd740cc5ab8 fuzz: Add a test case for `ParseByteUnits()` (Chandra Pratap)
Pull request description:
`ParseByteUnits()` is the only parsing function in `strencodings.cpp` lacking a fuzz test. Add a test case to check the function against arbitrary strings and randomized `default_multiplier`.
ACKs for top commit:
maflcko:
lgtm ACK 57b888ce0ebdeb34d866fd1511052fd740cc5ab8
dergoegge:
utACK 57b888ce0ebdeb34d866fd1511052fd740cc5ab8
marcofleon:
crACK 57b888ce0ebdeb34d866fd1511052fd740cc5ab8
Tree-SHA512: c16557442987437e5e0c9d9a8b016df93e513e34acb78242a1f73dabc4482632ec57eb35cb4c84f9a1ea838fa6bda2094f2a8b52ace431f8064a79fad96e9a52
This commit is contained in:
commit
eb19a2dac5
@ -147,4 +147,19 @@ FUZZ_TARGET(string)
|
||||
const bilingual_str bs2{random_string_2, random_string_1};
|
||||
(void)(bs1 + bs2);
|
||||
}
|
||||
{
|
||||
const ByteUnit all_units[] = {
|
||||
ByteUnit::NOOP,
|
||||
ByteUnit::k,
|
||||
ByteUnit::K,
|
||||
ByteUnit::m,
|
||||
ByteUnit::M,
|
||||
ByteUnit::g,
|
||||
ByteUnit::G,
|
||||
ByteUnit::t,
|
||||
ByteUnit::T
|
||||
};
|
||||
ByteUnit default_multiplier = fuzzed_data_provider.PickValueInArray(all_units);
|
||||
(void)ParseByteUnits(random_string_1, default_multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user