Commit 4c3633008 for imagemagick.org
commit 4c363300822ec3098911948f57ad2efed9d3897e
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Mon Jun 8 20:14:55 2026 +0200
Patch to make sure that a file is used when using the DNG coder inside the TIFF coder.
diff --git a/coders/tiff.c b/coders/tiff.c
index e36413f4a..9ad2165f0 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1274,11 +1274,28 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
ImageInfo
*read_info;
+ MagickBooleanType
+ has_unique_file = MagickFalse;
+
TIFFClose(tiff);
- image=DestroyImageList(image);
read_info=CloneImageInfo(image_info);
+ if (*read_info->filename == '\0')
+ {
+ status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
+ if (status == MagickFalse)
+ {
+ image=DestroyImageList(image);
+ return((Image *) NULL);
+ }
+ (void) ImageToFile(image,read_info->filename,exception);
+ (void) CloseBlob((Image *) image);
+ has_unique_file=MagickTrue;
+ }
+ image=DestroyImageList(image);
(void) CopyMagickString(read_info->magick,"DNG",MagickPathExtent);
image=ReadImage(read_info,exception);
+ if (has_unique_file != MagickFalse)
+ (void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
return(image);
}