Fixes off-by-one error when finding missing endstream
This commit is contained in:
parent
b82af5131f
commit
3df8f89bd4
@ -215,7 +215,7 @@ 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;
|
||||||
var found = false, i, ii, j;
|
var found = false, i, j;
|
||||||
for (i = 0, j = 0; i < scanLength; i++) {
|
for (i = 0, j = 0; i < scanLength; i++) {
|
||||||
var b = scanBytes[i];
|
var b = scanBytes[i];
|
||||||
if (b !== ENDSTREAM_SIGNATURE[j]) {
|
if (b !== ENDSTREAM_SIGNATURE[j]) {
|
||||||
@ -224,6 +224,7 @@ var Parser = (function ParserClosure() {
|
|||||||
} else {
|
} else {
|
||||||
j++;
|
j++;
|
||||||
if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
|
if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
|
||||||
|
i++;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user