You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/07/31 15:57:20 UTC

[jira] [Commented] (LANG-1162) StringUtils#equals fails with Index OOBE on non-Strings with identical leading prefix

    [ https://issues.apache.org/jira/browse/LANG-1162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15401209#comment-15401209 ] 

ASF GitHub Bot commented on LANG-1162:
--------------------------------------

GitHub user RamAnvesh opened a pull request:

    https://github.com/apache/commons-lang/pull/181

    Adding test cases for StringUtils.equals methods to cover LANG-1162/LANG-1239 etc

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/RamAnvesh/commons-lang master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/181.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 #181
    
----
commit b20d9b84c9d30b43c36f137b753e18950519be5e
Author: Ram Anvesh Reddy <su...@gmail.com>
Date:   2016-07-31T15:32:45Z

    Merge pull request #1 from apache/master
    
    Updating from apache:master

commit 8dea56a0a7d20ba61f8edb49da3b0a6233252d05
Author: Ram Anvesh Reddy <ra...@ramanvesh-macbook-pro.local>
Date:   2016-07-31T15:46:45Z

    LANG-1239 : Adding test cases for StringUtils.equals

----


> StringUtils#equals fails with Index OOBE on non-Strings with identical leading prefix
> -------------------------------------------------------------------------------------
>
>                 Key: LANG-1162
>                 URL: https://issues.apache.org/jira/browse/LANG-1162
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.4
>            Reporter: Sebb
>            Assignee: Sebb
>             Fix For: 3.5
>
>
> From the Commons User mailing list:
> {quote}
> StringUtils.equals(cs1,cs2) delegates to CharSequence.regionMatches(...) in a way that causes IndexOutOfBounds when either of cs1/cs2 isn't a String.
> Specifically, comparing "foo" and "foobar" for non-String CharSequences bombs due to CharSequenceUtils.regionMatches(cs1, false, 0, cs2, 0, Math.max(cs1.length(), cs2.length())) because regionMatches doesn't check for input exhaustion.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)