Weijun Liu created LANG-1828:
--------------------------------

             Summary: 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


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)

Reply via email to