mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
fuzz: Avoid unsigned integer overflow in FormatParagraph
This commit is contained in:
parent
8ac79973f8
commit
fa2f7d0059
2 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -328,6 +328,7 @@ bool ParseUInt64(const std::string& str, uint64_t* 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;
|
||||
|
|
Loading…
Add table
Reference in a new issue