Index: third_party/libtiff/tif_tile.c |
diff --git a/third_party/tiff_v403/tif_tile.c b/third_party/libtiff/tif_tile.c |
similarity index 90% |
rename from third_party/tiff_v403/tif_tile.c |
rename to third_party/libtiff/tif_tile.c |
index cb59a598e808d8c11f7c4ca3295c7b8df9e7ef61..388e168ac66b90c1c7ba6927707c17f38e7dab77 100644 |
--- a/third_party/tiff_v403/tif_tile.c |
+++ b/third_party/libtiff/tif_tile.c |
@@ -1,4 +1,4 @@ |
-/* $Id: tif_tile.c,v 1.23 2012-06-06 05:33:55 fwarmerdam Exp $ */ |
+/* $Id: tif_tile.c,v 1.24 2015-06-07 22:35:40 bfriesen Exp $ */ |
/* |
* Copyright (c) 1991-1997 Sam Leffler |
@@ -143,17 +143,40 @@ TIFFNumberOfTiles(TIFF* tif) |
uint64 |
TIFFTileRowSize64(TIFF* tif) |
{ |
+ static const char module[] = "TIFFTileRowSize64"; |
TIFFDirectory *td = &tif->tif_dir; |
uint64 rowsize; |
+ uint64 tilerowsize; |
- if (td->td_tilelength == 0 || td->td_tilewidth == 0) |
+ if (td->td_tilelength == 0) |
+ { |
+ TIFFErrorExt(tif->tif_clientdata,module,"Tile length is zero"); |
+ return 0; |
+ } |
+ if (td->td_tilewidth == 0) |
+ { |
+ TIFFErrorExt(tif->tif_clientdata,module,"Tile width is zero"); |
return (0); |
+ } |
rowsize = _TIFFMultiply64(tif, td->td_bitspersample, td->td_tilewidth, |
"TIFFTileRowSize"); |
if (td->td_planarconfig == PLANARCONFIG_CONTIG) |
+ { |
+ if (td->td_samplesperpixel == 0) |
+ { |
+ TIFFErrorExt(tif->tif_clientdata,module,"Samples per pixel is zero"); |
+ return 0; |
+ } |
rowsize = _TIFFMultiply64(tif, rowsize, td->td_samplesperpixel, |
"TIFFTileRowSize"); |
- return (TIFFhowmany8_64(rowsize)); |
+ } |
+ tilerowsize=TIFFhowmany8_64(rowsize); |
+ if (tilerowsize == 0) |
+ { |
+ TIFFErrorExt(tif->tif_clientdata,module,"Computed tile row size is zero"); |
+ return 0; |
+ } |
+ return (tilerowsize); |
} |
tmsize_t |
TIFFTileRowSize(TIFF* tif) |
@@ -297,4 +320,3 @@ _TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th) |
* fill-column: 78 |
* End: |
*/ |
- |