commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [lang] StringUtils.equals bug on non-Strings with identical leading prefix
Date Mon, 10 Aug 2015 21:12:14 GMT
On 10 August 2015 at 19:14, Aman Agarwal <Aman.Agarwal@twosigma.com> wrote:
> 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.

I can confirm the problem.
The existing tests don't show it because they use Strings rather than
(say)  StringBuffer.

Created a JIRA:

https://issues.apache.org/jira/browse/LANG-1162

Note: if you find any other such issues, it would be very helpful if
you could file a JIRA issue, as per

http://commons.apache.org/proper/commons-lang/issue-tracking.html

Thanks!

>
>
> Bug appears in default.
>
>
>
> -          Aman
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message