[ https://issues.apache.org/jira/browse/LANG-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15598867#comment-15598867 ]
ASF GitHub Bot commented on LANG-1276: -------------------------------------- GitHub user andyklimczak opened a pull request: https://github.com/apache/commons-lang/pull/200 LANG-1276 Fix issue of buf using nonupdated buffer in StrBuilder replaceImpl Avoid array OoB error by keeping variable buf consistent with buffer You can merge this pull request into a Git repository by running: $ git pull https://github.com/andyklimczak/commons-lang LANG-1276 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/200.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #200 ---- commit 0dd44493d70188ed6145cdb130537532cbc68522 Author: Andy Klimczak <andyklimc...@fastmail.com> Date: 2016-10-23T01:54:14Z LANG-1276 Avoid array OOB error by keeping variable buf consistent with buffer in StrBuilder replaceImpl ---- > [lang] ArrayIndexOutOfBoundsException StrBuilder replace > -------------------------------------------------------- > > Key: LANG-1276 > URL: https://issues.apache.org/jira/browse/LANG-1276 > Project: Commons Lang > Issue Type: Bug > Affects Versions: 3.2.1, 3.4, 3.5 > Reporter: Andreas Skomedal > Fix For: Patch Needed, 3.6 > > > There is a bug in replace for StrBuilder, seems the use of nonupdated buffer > and character count is off. > new StrBuilder("Dear X, hello X.").replaceAll(StrMatcher.stringMatcher("X"), > "012345678901234567"); > yields > {noformat} > java.lang.ArrayIndexOutOfBoundsException: 49 > at > org.apache.commons.lang3.text.StrMatcher$StringMatcher.isMatch(StrMatcher.java:372) > at > org.apache.commons.lang3.text.StrBuilder.replaceImpl(StrBuilder.java:2115) > at > org.apache.commons.lang3.text.StrBuilder.replace(StrBuilder.java:2088) > at > org.apache.commons.lang3.text.StrBuilder.replaceAll(StrBuilder.java:2049) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)