From e99c4b816ad53c36e72edceaee5c8498fa331a31 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 14 Mar 2020 00:10:29 +0100 Subject: [PATCH] tif_win32.c: do not _tiffMapProc() 0 sized files see #22 --- libtiff/tif_win32.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libtiff/tif_win32.c b/libtiff/tif_win32.c index bf5fbfb3..b3110b23 100644 --- a/libtiff/tif_win32.c +++ b/libtiff/tif_win32.c @@ -156,8 +156,10 @@ static uint64 _tiffSizeProc(thandle_t fd) { ULARGE_INTEGER m; - m.LowPart=GetFileSize(fd,&m.HighPart); - return(m.QuadPart); + if (GetFileSizeEx(fd,&m)) + return(m.QuadPart); + else + return(0); } static int @@ -189,7 +191,7 @@ _tiffMapProc(thandle_t fd, void** pbase, toff_t* psize) size = _tiffSizeProc(fd); sizem = (tmsize_t)size; - if ((uint64)sizem!=size) + if (!size || (uint64)sizem!=size) return (0); /* By passing in 0 for the maximum file size, it specifies that we