#2098: scanning for stream length when it's incorrect

This commit is contained in:
Yury Delendik 2013-06-22 13:21:19 -05:00
parent c3096d98d4
commit 4d9ee7b530
3 changed files with 55 additions and 2 deletions

View file

@ -57,6 +57,11 @@ var Stream = (function StreamClosure() {
this.pos = end;
return bytes.subarray(pos, end);
},
peekBytes: function Stream_peekBytes(length) {
var bytes = this.getBytes(length);
this.pos -= bytes.length;
return bytes;
},
lookChar: function Stream_lookChar() {
if (this.pos >= this.end)
return null;
@ -161,6 +166,11 @@ var DecodeStream = (function DecodeStreamClosure() {
this.pos = end;
return this.buffer.subarray(pos, end);
},
peekBytes: function DecodeStream_peekBytes(length) {
var bytes = this.getBytes(length);
this.pos -= bytes.length;
return bytes;
},
lookChar: function DecodeStream_lookChar() {
var pos = this.pos;
while (this.bufferLength <= pos) {