diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-02-09 14:38:56 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-02-09 14:38:22 +0100 |
commit | fa2f7d005932bff9b7d27744ae517b9e7910df8d (patch) | |
tree | 677b15d787e4425d8b496f23144f130627d4aedd /src/test | |
parent | 8ac79973f8e923e9f1f560f4909b912ccea34035 (diff) | |
download | bitcoin-fa2f7d005932bff9b7d27744ae517b9e7910df8d.tar.xz |
fuzz: Avoid unsigned integer overflow in FormatParagraph
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/string.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp index 8f071b71fe..ca57af25c4 100644 --- a/src/test/fuzz/string.cpp +++ b/src/test/fuzz/string.cpp @@ -145,7 +145,8 @@ FUZZ_TARGET(string) (void)CopyrightHolders(random_string_1); FeeEstimateMode fee_estimate_mode; (void)FeeModeFromString(random_string_1, fee_estimate_mode); - (void)FormatParagraph(random_string_1, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 1000), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 1000)); + const auto width{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, 1000)}; + (void)FormatParagraph(random_string_1, width, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, width)); (void)FormatSubVersion(random_string_1, fuzzed_data_provider.ConsumeIntegral<int>(), random_string_vector); (void)GetDescriptorChecksum(random_string_1); (void)HelpExampleCli(random_string_1, random_string_2); |