From 3df8f89bd490f09f193ceab2f59e844bacc316f4 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Thu, 6 Mar 2014 23:57:27 +0100 Subject: [PATCH] Fixes off-by-one error when finding missing endstream --- src/core/parser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/parser.js b/src/core/parser.js index 9fc20ded0..f5eaa1b41 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -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]) { @@ -224,6 +224,7 @@ var Parser = (function ParserClosure() { } else { j++; if (j >= ENDSTREAM_SIGNATURE_LENGTH) { + i++; found = true; break; }