* libtiff/tif_dirwrite.c: fix truncation to 32 bit of file offsets in

TIFFLinkDirectory() and TIFFWriteDirectorySec() when aligning directory
offsets on a even offset (affects BigTIFF)
This commit is contained in:
Even Rouault 2015-12-18 11:11:00 +00:00
parent 845ee2f85b
commit 56ae8c1ee3
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2015-12-18 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_dirwrite.c: fix truncation to 32 bit of file offsets in
TIFFLinkDirectory() and TIFFWriteDirectorySec() when aligning directory
offsets on a even offset (affects BigTIFF)
2015-12-12 Even Rouault <even.rouault at spatialys.com> 2015-12-12 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_write.c: TIFFWriteEncodedStrip() and TIFFWriteEncodedTile() * libtiff/tif_write.c: TIFFWriteEncodedStrip() and TIFFWriteEncodedTile()

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirwrite.c,v 1.80 2015-11-22 15:31:03 erouault Exp $ */ /* $Id: tif_dirwrite.c,v 1.81 2015-12-18 11:11:00 erouault Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -780,7 +780,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
goto bad; goto bad;
} }
else else
tif->tif_diroff=(TIFFSeekFile(tif,0,SEEK_END)+1)&(~1U); tif->tif_diroff=(TIFFSeekFile(tif,0,SEEK_END)+1)&(~((toff_t)1));
if (pdiroff!=NULL) if (pdiroff!=NULL)
*pdiroff=tif->tif_diroff; *pdiroff=tif->tif_diroff;
if (!(tif->tif_flags&TIFF_BIGTIFF)) if (!(tif->tif_flags&TIFF_BIGTIFF))
@ -2370,7 +2370,7 @@ TIFFLinkDirectory(TIFF* tif)
{ {
static const char module[] = "TIFFLinkDirectory"; static const char module[] = "TIFFLinkDirectory";
tif->tif_diroff = (TIFFSeekFile(tif,0,SEEK_END)+1) &~ 1U; tif->tif_diroff = (TIFFSeekFile(tif,0,SEEK_END)+1) & (~((toff_t)1));
/* /*
* Handle SubIFDs * Handle SubIFDs