* libtiff/tif_getimage.c: avoid divide by zero on invalid YCbCr subsampling.

http://bugzilla.maptools.org/show_bug.cgi?id=2235
This commit is contained in:
Even Rouault 2014-12-24 16:57:18 +00:00
parent 34d71374cc
commit 65577375d4
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-12-24 Even Rouault <even.rouault@spatialys.com>
* libtiff/tif_getimage.c: avoid divide by zero on invalid YCbCr subsampling.
http://bugzilla.maptools.org/show_bug.cgi?id=2235
2014-12-24 Even Rouault <even.rouault@spatialys.com> 2014-12-24 Even Rouault <even.rouault@spatialys.com>
* tools/tiff2pdf.c: fix buffer overflow on some YCbCr JPEG compressed images. * tools/tiff2pdf.c: fix buffer overflow on some YCbCr JPEG compressed images.

View File

@ -1,4 +1,4 @@
/* $Id: tif_getimage.c,v 1.83 2014-12-21 15:15:31 erouault Exp $ */ /* $Id: tif_getimage.c,v 1.84 2014-12-24 16:57:18 erouault Exp $ */
/* /*
* Copyright (c) 1991-1997 Sam Leffler * Copyright (c) 1991-1997 Sam Leffler
@ -875,6 +875,10 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver); TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver);
if( subsamplingver == 0 ) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Invalid vertical YCbCr subsampling");
return (0);
}
scanline = TIFFScanlineSize(tif); scanline = TIFFScanlineSize(tif);
fromskew = (w < imagewidth ? imagewidth - w : 0); fromskew = (w < imagewidth ? imagewidth - w : 0);
for (row = 0; row < h; row += nrow) for (row = 0; row < h; row += nrow)