diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-30 15:18:55 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-30 15:18:55 +0200 |
commit | ceb2eddd75882106105b36a8db24ddb555b4cfb2 (patch) | |
tree | ef539f7fe757c9fcb5955e5e506ac38de981f17d /src/dotty/tools/dotc/core/pickling/TastyBuffer.scala | |
parent | 10d05f34a8c3f006c6a0aabed04c47cb7566cc46 (diff) | |
download | dotty-ceb2eddd75882106105b36a8db24ddb555b4cfb2.tar.gz dotty-ceb2eddd75882106105b36a8db24ddb555b4cfb2.tar.bz2 dotty-ceb2eddd75882106105b36a8db24ddb555b4cfb2.zip |
Fix two ArrayIndexOutOfBoundsExceptions in TastyBuffer.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/TastyBuffer.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/TastyBuffer.scala | 5 |
1 files changed, 4 insertions, 1 deletions
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 |