commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Schumacher (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LANG-1287) RandomStringUtils#random can enter infinite loop if end parameter is to small
Date Fri, 18 Nov 2016 15:41:58 GMT
Pascal Schumacher created LANG-1287:
---------------------------------------

             Summary: RandomStringUtils#random can enter infinite loop if end parameter is
to small
                 Key: LANG-1287
                 URL: https://issues.apache.org/jira/browse/LANG-1287
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
    Affects Versions: 3.5
            Reporter: Pascal Schumacher
            Assignee: Pascal Schumacher


{quote}I faced that the random method can cause an infinite loop. It can be caused if the
end parameter is too low for generating either numbers (< 48) or letters (<65). I added
some exception tests to make the cases clear. Basically, if we call the random function with
for example numbers = true && end < 48
the validation for Character.isDigit(ch) will fail and we increment count count++.{quote}

Ivan Morozov https://github.com/apache/commons-lang/pull/211



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

Mime
View raw message