From fa778a1732a4a8cc4b27b822dd181f1c6a6c82e0 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Thu, 29 Feb 2024 17:10:55 +0300 Subject: [PATCH] OlympusDecompressor: operate on `mRaw->dim` directly --- src/librawspeed/decompressors/OlympusDecompressor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/librawspeed/decompressors/OlympusDecompressor.cpp b/src/librawspeed/decompressors/OlympusDecompressor.cpp index e3d895c85..e83bcf771 100644 --- a/src/librawspeed/decompressors/OlympusDecompressor.cpp +++ b/src/librawspeed/decompressors/OlympusDecompressor.cpp @@ -219,11 +219,10 @@ OlympusDecompressor::OlympusDecompressor(RawImage img) : mRaw(std::move(img)) { mRaw->getBpp() != sizeof(uint16_t)) ThrowRDE("Unexpected component count / data type"); - const uint32_t w = mRaw->dim.x; - const uint32_t h = mRaw->dim.y; - - if (w == 0 || h == 0 || w % 2 != 0 || h % 2 != 0 || w > 10400 || h > 7792) - ThrowRDE("Unexpected image dimensions found: (%u; %u)", w, h); + if (!mRaw->dim.hasPositiveArea() || mRaw->dim.x % 2 != 0 || + mRaw->dim.y % 2 != 0 || mRaw->dim.x > 10400 || mRaw->dim.y > 7792) + ThrowRDE("Unexpected image dimensions found: (%u; %u)", mRaw->dim.x, + mRaw->dim.y); } void OlympusDecompressor::decompress(ByteStream input) const {