From ceb2eddd75882106105b36a8db24ddb555b4cfb2 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Thu, 30 Apr 2015 15:18:55 +0200 Subject: Fix two ArrayIndexOutOfBoundsExceptions in TastyBuffer. --- src/dotty/tools/dotc/core/pickling/TastyBuffer.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/pickling/TastyBuffer.scala') diff --git a/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala b/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala index a67722227..f57c15a3d 100644 --- a/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala +++ b/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala @@ -44,7 +44,8 @@ class TastyBuffer(initialSize: Int) { /** Write a byte of data. */ def writeByte(b: Int): Unit = { - if (length == bytes.length) bytes = dble(bytes) + if (length >= bytes.length) + bytes = dble(bytes) bytes(length) = b.toByte length += 1 } @@ -116,6 +117,8 @@ class TastyBuffer(initialSize: Int) { def putNat(at: Addr, x: Int, width: Int): Unit = { var y = x var w = width + if(at.index + w >= bytes.length) + bytes = dble(bytes) var digit = y & 0x7f | 0x80 while (w > 0) { w -= 1 -- cgit v1.2.3