From d2ee92f05561d2f58f6353856ccbf6467f9b23d9 Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Wed, 18 Dec 2013 00:34:00 +0100 Subject: 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. --- test/files/run/t7880.scala | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/files/run/t7880.scala (limited to 'test/files/run') 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 => } +} -- cgit v1.2.3