Prevent infinite loop when scanning for endstream (bug 1020226)

This commit is contained in:
Jonas Jenwald 2014-06-06 22:06:29 +02:00
parent 806aa36aa8
commit 26bbcedcae

View File

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