the input string has a huge prefix which is taken to be the indentation (such as “- - - - -”), and
the wrapping with is set to something small (such as 0),
then we can end up allocating an enormous amount of data in the output. The problem is that we add the indentation on every line of the output, and we end up with a huge number of lines when the line width is small.
If two things happen at the same time:
then we can end up allocating an enormous amount of data in the output. The problem is that we add the indentation on every line of the output, and we end up with a huge number of lines when the line width is small.
This was reported in OSS-Fuzz, please see https://oss-fuzz.com/testcase-detail/4890847154143232.