libtiff: Merge branch 'coverity_fixes_test_thumbnail' into 'master'

From fe77ab2933d6d3f1252748b195439ec1f32efd3f Mon Sep 17 00:00:00 2001
From: Su Laus <[EMAIL REDACTED]>
Date: Fri, 28 Jun 2024 13:36:35 +0000
Subject: [PATCH] Coverity Scan fixes in thumbnail.c and custom_dir_EXIF_231.c

---
 test/custom_dir_EXIF_231.c | 2 +-
 tools/thumbnail.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/custom_dir_EXIF_231.c b/test/custom_dir_EXIF_231.c
index 18ee91e5..3ce7a0d0 100644
--- a/test/custom_dir_EXIF_231.c
+++ b/test/custom_dir_EXIF_231.c
@@ -1002,7 +1002,7 @@ int write_test_tiff(TIFF *tif, const char *filenameRead)
     {
         fprintf(stderr, "Can't read %s\n", "TIFFTAG_IMAGELENGTH");
     }
-    if (auxUint32 != width)
+    if (auxUint32 != length)
     {
         fprintf(stderr,
                 "Read value of TIFFTAG_IMAGELENGTH %" PRIu32
diff --git a/tools/thumbnail.c b/tools/thumbnail.c
index 8ce0d9b0..b4cb114c 100644
--- a/tools/thumbnail.c
+++ b/tools/thumbnail.c
@@ -563,7 +563,7 @@ static void setupStepTables(uint32_t sw)
             }
             rowoff[x] = sx0 >> 3;
             fw = sx - sx0; /* width */
-            b = (fw < 8) ? 0xff << (8 - fw) : 0xff;
+            b = (fw < 8) ? (uint8_t)(0xff << (8 - fw)) : (uint8_t)0xff;
             src0[x] = b >> (sx0 & 7);
             fw -= 8 - (sx0 & 7);
             if (fw < 0)