You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ensureSize below, when n > Int.MaxValue then newsize: Int may overflow (newsize = newsize * 2) and become negative. Once negative the while loop will never terminate.
How to reproduce: fill an ArrayBuffer with about 2GB of Bytes.
protected def ensureSize(n: Int) {
if (n > array.length) {
var newsize = array.length * 2
while (n > newsize)
newsize = newsize * 2
val newar: Array[AnyRef] = new Array(newsize)
scala.compat.Platform.arraycopy(array, 0, newar, 0, size0)
array = newar
}
}
The text was updated successfully, but these errors were encountered:
In ensureSize below, when n > Int.MaxValue then newsize: Int may overflow (newsize = newsize * 2) and become negative. Once negative the while loop will never terminate.
How to reproduce: fill an ArrayBuffer with about 2GB of Bytes.
protected def ensureSize(n: Int) {
if (n > array.length) {
var newsize = array.length * 2
while (n > newsize)
newsize = newsize * 2
}
The text was updated successfully, but these errors were encountered: