BAEL-1913 fix possible index out of bound
This commit is contained in:
parent
8e5a2ba1fe
commit
d2d77c56f8
|
@ -52,7 +52,7 @@ class RandomStringUnitTest {
|
|||
random.nextBytes(bytes)
|
||||
|
||||
var randomString = (0..bytes.size - 1).map { i ->
|
||||
charPool.get((bytes[i] and 0xFF.toByte() and charPool.size.toByte()).toInt())
|
||||
charPool.get((bytes[i] and 0xFF.toByte() and (charPool.size-1).toByte()).toInt())
|
||||
}.joinToString("")
|
||||
|
||||
assert(randomString.matches(Regex(ALPHANUMERIC_REGEX)))
|
||||
|
|
Loading…
Reference in New Issue