|
|
- commit 307a31765cb01245e3655ce168385dd7d51e14bd
- Author: erouault <erouault>
- Date: Sat Dec 3 15:44:15 2016 +0000
-
- * tools/tiffcp.c: avoid potential division by zero if BitsPerSamples tag is
- missing.
- Reported by Agostino Sarubbo.
- Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2607
-
- diff --git a/ChangeLog b/ChangeLog
- index ac2d922..94be038 100644
- --- a/ChangeLog
- +++ b/ChangeLog
- @@ -1,5 +1,12 @@
- 2016-12-03 Even Rouault <even.rouault at spatialys.com>
-
- + * tools/tiffcp.c: avoid potential division by zero if BitsPerSamples tag is
- + missing.
- + Reported by Agostino Sarubbo.
- + Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2607
- +
- +2016-12-03 Even Rouault <even.rouault at spatialys.com>
- +
- * tools/tif_dir.c: when TIFFGetField(, TIFFTAG_NUMBEROFINKS, ) is called,
- limit the return number of inks to SamplesPerPixel, so that code that parses
- ink names doesn't go past the end of the buffer.
- diff --git a/tools/tiffcp.c b/tools/tiffcp.c
- index c8e48c3..142cbb0 100644
- --- a/tools/tiffcp.c
- +++ b/tools/tiffcp.c
- @@ -1,4 +1,4 @@
- -/* $Id: tiffcp.c,v 1.57 2016-12-03 14:42:40 erouault Exp $ */
- +/* $Id: tiffcp.c,v 1.58 2016-12-03 15:44:15 erouault Exp $ */
-
- /*
- * Copyright (c) 1988-1997 Sam Leffler
- @@ -1569,7 +1569,7 @@ DECLAREwriteFunc(writeBufferToSeparateTiles)
- uint8* bufp = (uint8*) buf;
- uint32 tl, tw;
- uint32 row;
- - uint16 bps, bytes_per_sample;
- + uint16 bps = 0, bytes_per_sample;
-
- obuf = _TIFFmalloc(TIFFTileSize(out));
- if (obuf == NULL)
- @@ -1578,6 +1578,12 @@ DECLAREwriteFunc(writeBufferToSeparateTiles)
- (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
- (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
- (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);
- + if( bps == 0 )
- + {
- + TIFFError(TIFFFileName(out), "Error, cannot read BitsPerSample");
- + _TIFFfree(obuf);
- + return 0;
- + }
- assert( bps % 8 == 0 );
- bytes_per_sample = bps/8;
-
|