libtiff: Merge branch 'fix_TIFFRealloc_usage_to_TIFFReallocExt' into 'master'

From b87fadea8ef5776160d36c6c2d43e502ac8e85e9 Mon Sep 17 00:00:00 2001
From: Su_Laus <[EMAIL REDACTED]>
Date: Sat, 11 Nov 2023 17:17:33 +0100
Subject: [PATCH] Change internally used _TIFFRealloc() to _TIFFReallocExt(),
 which respects the TIFFOpenOptionsSetMaxSingleMemAlloc() limit.

---
 libtiff/tif_read.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c
index 4fec8396..437c1a05 100644
--- a/libtiff/tif_read.c
+++ b/libtiff/tif_read.c
@@ -105,8 +105,8 @@ static int TIFFReadAndRealloc(TIFF *tif, tmsize_t size, tmsize_t rawdata_offset,
                 TIFFErrorExtR(tif, module, "Invalid buffer size");
                 return 0;
             }
-            new_rawdata =
-                (uint8_t *)_TIFFrealloc(tif->tif_rawdata, tif->tif_rawdatasize);
+            new_rawdata = (uint8_t *)_TIFFreallocExt(tif, tif->tif_rawdata,
+                                                     tif->tif_rawdatasize);
             if (new_rawdata == 0)
             {
                 TIFFErrorExtR(tif, module,