Skip to content

Commit

Permalink
Merge pull request #4404 from timvandermeij/invalid-number-e
Browse files Browse the repository at this point in the history
Fixes off-by-one error when finding missing endstream
  • Loading branch information
yurydelendik committed Mar 6, 2014
2 parents b82af51 + 3df8f89 commit 3e93104
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var Parser = (function ParserClosure() {
while (stream.pos < stream.end) {
var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
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++) {
var b = scanBytes[i];
if (b !== ENDSTREAM_SIGNATURE[j]) {
Expand All @@ -224,6 +224,7 @@ var Parser = (function ParserClosure() {
} else {
j++;
if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
i++;
found = true;
break;
}
Expand Down

0 comments on commit 3e93104

Please sign in to comment.