From a6f0609a6e40db3f8b741b19aacff354f9d4647b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 20 Nov 2023 17:33:49 +0100 Subject: [PATCH] Throw a `JpegError` when a JPEG image has no frame data (issue 17302) Given that there's nothing to parse in this case, since we're dealing with an invalid JPEG image, throwing an *explicit* Error makes sense here. --- src/core/jpg.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/jpg.js b/src/core/jpg.js index de3673879252f..08a992afd3752 100644 --- a/src/core/jpg.js +++ b/src/core/jpg.js @@ -1073,6 +1073,9 @@ class JpegImage { offset += 2; } + if (!frame) { + throw new JpegError("JpegImage.parse - no frame data found."); + } this.width = frame.samplesPerLine; this.height = frame.scanLines; this.jfif = jfif;