From 518d26dfb4a5d97c6247034513b8923f21169632 Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Fri, 17 Apr 2020 15:40:02 +0200
Subject: [PATCH] [src/core/jpg.js] Remove redundant marker validation at the
 end of the `decodeScan` function (PR 11805 follow-up)

With the MCU parsing changes made in PR 11805, the final marker validation is no longer necessary before the `decodeScan` function returns.
---
 src/core/jpg.js | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/core/jpg.js b/src/core/jpg.js
index 8df06677f..619cf5c35 100644
--- a/src/core/jpg.js
+++ b/src/core/jpg.js
@@ -136,8 +136,8 @@ var JpegImage = (function JpegImageClosure() {
     var mcusPerLine = frame.mcusPerLine;
     var progressive = frame.progressive;
 
-    var startOffset = offset,
-      bitsData = 0,
+    const startOffset = offset;
+    let bitsData = 0,
       bitsCount = 0;
 
     function readBit() {
@@ -455,16 +455,6 @@ var JpegImage = (function JpegImageClosure() {
       }
     }
 
-    fileMarker = findNextFileMarker(data, offset);
-    // Some images include more Scan blocks than expected, skip past those and
-    // attempt to find the next valid marker (fixes issue8182.pdf).
-    if (fileMarker && fileMarker.invalid) {
-      warn(
-        `decodeScan - unexpected Scan data, current marker is: ${fileMarker.invalid}`
-      );
-      offset = fileMarker.offset;
-    }
-
     return offset - startOffset;
   }