ppkarwasz commented on code in PR #1649:
URL: https://github.com/apache/commons-lang/pull/1649#discussion_r3255402556
##########
src/main/java/org/apache/commons/lang3/text/WordUtils.java:
##########
@@ -652,21 +652,19 @@ public static String wrap(final String str, int
wrapLength, String newLineStr, f
str.substring(offset, Math.min((int)
Math.min(Integer.MAX_VALUE, offset + wrapLength + 1L), inputLineLength)));
if (matcher.find()) {
if (matcher.start() == 0) {
- offset += matcher.end();
+ // If the match is zero-width, advance by at least 1 to
avoid infinite loop.
+ offset += matcher.end() > 0 ? matcher.end() : 1;
Review Comment:
I'll make a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]