Merge branch 'issue-22' into 'master'

do not _tiffMapProc 0 size files

Closes #22

See merge request libtiff/libtiff!125
This commit is contained in:
Even Rouault 2020-03-17 22:51:09 +00:00
commit 7c8dafc28c
2 changed files with 6 additions and 4 deletions

View File

@ -162,7 +162,7 @@ _tiffMapProc(thandle_t fd, void** pbase, toff_t* psize)
{
uint64 size64 = _tiffSizeProc(fd);
tmsize_t sizem = (tmsize_t)size64;
if ((uint64)sizem==size64) {
if (size64 && (uint64)sizem==size64) {
fd_as_handle_union_t fdh;
fdh.h = fd;
*pbase = (void*)

View File

@ -156,8 +156,10 @@ static uint64
_tiffSizeProc(thandle_t fd)
{
ULARGE_INTEGER m;
m.LowPart=GetFileSize(fd,&m.HighPart);
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