From 63f717036daad19e87b0f305a35ebd7644d69470 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Tue, 26 Mar 2024 02:42:46 +0300 Subject: [PATCH] LJpegDecoder: Maximal output tile size should be a multiple of LJpeg frame size --- src/librawspeed/decompressors/LJpegDecoder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librawspeed/decompressors/LJpegDecoder.cpp b/src/librawspeed/decompressors/LJpegDecoder.cpp index f64cbe496..96e704554 100644 --- a/src/librawspeed/decompressors/LJpegDecoder.cpp +++ b/src/librawspeed/decompressors/LJpegDecoder.cpp @@ -132,6 +132,9 @@ Buffer::size_type LJpegDecoder::decodeScan() { if (maxRes.area() != N_COMP * jpegFrame.dim.area()) ThrowRDE("LJpeg frame area does not match maximal tile area"); + if (maxRes.x % jpegFrame.dim.x != 0 || maxRes.y % jpegFrame.dim.y != 0) + ThrowRDE("Maximal output tile size is not a multiple of LJpeg frame size"); + int numRowsPerRestartInterval; if (numMCUsPerRestartInterval == 0) { // Restart interval not enabled, so all of the rows