Commit 0af4ede10 for imagemagick.org

commit 0af4ede10f4b4d700ea7dcf1608b13fe8219a5a0
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Mon Jul 27 17:59:52 2026 +0200

    Make sure we read the bits_per_sample before using it.

diff --git a/coders/tiff.c b/coders/tiff.c
index 1f63381e3..2ee9de0af 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -3998,6 +3998,8 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
 #if defined(COMPRESSION_LZMA)
       case COMPRESSION_LZMA:
       {
+        (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,
+          &bits_per_sample,sans);
         if (((photometric == PHOTOMETRIC_RGB) ||
              (photometric == PHOTOMETRIC_SEPARATED) ||
              (photometric == PHOTOMETRIC_MINISBLACK)) &&