[
https://issues.apache.org/jira/browse/LANG-1828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092430#comment-18092430
]
Dhruv Aggarwal commented on LANG-1828:
--------------------------------------
Opened PR [#1736|https://github.com/apache/commons-lang/pull/1736] with a fix.
> StringUtils.rightPad() throws OutOfMemoryError when size is Integer.MIN_VALUE
> -----------------------------------------------------------------------------
>
> Key: LANG-1828
> URL: https://issues.apache.org/jira/browse/LANG-1828
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: Discussion
> Reporter: Weijun Liu
> Priority: Major
>
> StringUtils.rightPad(String str, int size, String padStr) throws
> OutOfMemoryError instead of returning the original string when size is
> Integer.MIN_VALUE.
> Per the API contract, a negative size should return the original string:
> ▎ StringUtils.rightPad("bat", -1, "yz") = "bat"
> However, Integer.MIN_VALUE (-2147483648) is a negative value that violates
> this contract due to an integer overflow.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)