diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp index 2c7b19e39a..e7c046373e 100644 --- a/src/test/fuzz/string.cpp +++ b/src/test/fuzz/string.cpp @@ -45,7 +45,8 @@ void test_one_input(const std::vector& buffer) (void)CopyrightHolders(random_string_1, fuzzed_data_provider.ConsumeIntegral(), fuzzed_data_provider.ConsumeIntegral()); FeeEstimateMode fee_estimate_mode; (void)FeeModeFromString(random_string_1, fee_estimate_mode); - (void)FormatParagraph(random_string_1, fuzzed_data_provider.ConsumeIntegralInRange(0, 1000), fuzzed_data_provider.ConsumeIntegralInRange(0, 1000)); + const auto width{fuzzed_data_provider.ConsumeIntegralInRange(1, 1000)}; + (void)FormatParagraph(random_string_1, width, fuzzed_data_provider.ConsumeIntegralInRange(0, width)); (void)FormatSubVersion(random_string_1, fuzzed_data_provider.ConsumeIntegral(), random_string_vector); (void)GetDescriptorChecksum(random_string_1); (void)HelpExampleCli(random_string_1, random_string_2); diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp index bcbaac3291..0bfdb083a1 100644 --- a/src/util/strencodings.cpp +++ b/src/util/strencodings.cpp @@ -384,6 +384,7 @@ bool ParseDouble(const std::string& str, double *out) std::string FormatParagraph(const std::string& in, size_t width, size_t indent) { + assert(width >= indent); std::stringstream out; size_t ptr = 0; size_t indented = 0;