diff options
author | Simon Ochsenreither <simon@ochsenreither.de> | 2013-12-18 00:34:00 +0100 |
---|---|---|
committer | Simon Ochsenreither <simon@ochsenreither.de> | 2013-12-23 10:50:57 +0100 |
commit | d2ee92f05561d2f58f6353856ccbf6467f9b23d9 (patch) | |
tree | 6944b2cc65cdce120c0943f8e99898c5540d4cd6 /test | |
parent | b5ef79f2f8bc010220d2920a890352d96ad84b45 (diff) | |
download | scala-d2ee92f05561d2f58f6353856ccbf6467f9b23d9.tar.gz scala-d2ee92f05561d2f58f6353856ccbf6467f9b23d9.tar.bz2 scala-d2ee92f05561d2f58f6353856ccbf6467f9b23d9.zip |
SI-7880 Fix infinite loop in ResizableArray#ensureSize
This issue was triggered for values greater than Int.MaxValue/2, which
caused the computation of the new array size to overflow and become
negative, leading to an infinite loop.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t7880.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/run/t7880.scala b/test/files/run/t7880.scala new file mode 100644 index 0000000000..9fbc337f87 --- /dev/null +++ b/test/files/run/t7880.scala @@ -0,0 +1,7 @@ +object Test extends App { + // This should terminate in one way or another, but it shouldn't loop forever. + try { + val buffer = collection.mutable.ArrayBuffer.fill(Int.MaxValue / 2 + 1)(0) + buffer append 1 + } catch { case _: OutOfMemoryError => } +} |