From 9c5e0f97a1816d2b1538a1a508092b8dd7e53164 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Fri, 19 May 2023 14:14:05 +0200 Subject: [PATCH] [DNGDecoder] Images consisting of a single padded tile are well-formed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Topaz Photo AI" seems to be producing such rather weird files. Looking at the actual images, it's *clearly* a bug in said software. But there is an argument to be made that [DNG] tiles can have padding rows/cols, and while it may seem, err, non-conventional, to have a single tile with size much larger than the actual image size, that isn’t exactly illegal. https://discuss.pixls.us/t/darktable-dxo-topaz-raw-denoise-dngs/37127/14 Co-authored-by: Miloš Komarčević --- src/librawspeed/decoders/DngDecoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librawspeed/decoders/DngDecoder.cpp b/src/librawspeed/decoders/DngDecoder.cpp index 6ea577884..dc3aae29a 100644 --- a/src/librawspeed/decoders/DngDecoder.cpp +++ b/src/librawspeed/decoders/DngDecoder.cpp @@ -334,7 +334,7 @@ DngDecoder::getTilingDescription(const TiffIFD* raw) const { ? raw->getEntry(TiffTag::ROWSPERSTRIP)->getU32() : mRaw->dim.y; - if (yPerSlice == 0 || yPerSlice > static_cast(mRaw->dim.y) || + if (yPerSlice == 0 || roundUpDivision(mRaw->dim.y, yPerSlice) != counts->count) { ThrowRDE("Invalid y per slice %u or strip count %u (height = %u)", yPerSlice, counts->count, mRaw->dim.y);