Merge pull request #4902 from Snuffleupagus/bug-1020226

Prevent infinite loop when scanning for endstream (bug 1020226)
This commit is contained in:
Yury Delendik 2014-06-10 08:55:20 -05:00
commit 2da1942863

View File

@ -266,6 +266,9 @@ var Parser = (function ParserClosure() {
while (stream.pos < stream.end) {
var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
if (scanLength <= 0) {
break;
}
found = false;
for (i = 0, j = 0; i < scanLength; i++) {
var b = scanBytes[i];