libtiff: TIFFReadDirectoryCheckOrder: avoid integer overflow

From 54eeadb88b74b3d6548bef3a2803dbaf333dc5dc Mon Sep 17 00:00:00 2001
From: headshog <[EMAIL REDACTED]>
Date: Mon, 17 Jul 2023 09:50:42 +0000
Subject: [PATCH] TIFFReadDirectoryCheckOrder: avoid integer overflow

When it occurs, it should be harmless in practice though
---
 libtiff/tif_dirread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index 717cbc84..2c49dc6a 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -5038,7 +5038,7 @@ static void TIFFReadDirectoryCheckOrder(TIFF *tif, TIFFDirEntry *dir,
                                         uint16_t dircount)
 {
     static const char module[] = "TIFFReadDirectoryCheckOrder";
-    uint16_t m;
+    uint32_t m;
     uint16_t n;
     TIFFDirEntry *o;
     m = 0;