(TIFFWriteScanline): Fix Coverity 715979 "Division or modulo by

zero".
This commit is contained in:
Bob Friesenhahn 2015-06-07 23:00:23 +00:00
parent b989c28d1c
commit d5d24e7065
2 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,8 @@
or modulo by zero". or modulo by zero".
(TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo by (TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo by
zero". zero".
(TIFFWriteScanline): Fix Coverity 715979 "Division or modulo by
zero".
* libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973 and * libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973 and
715974 "Division or modulo by zero". 715974 "Division or modulo by zero".

View File

@ -1,4 +1,4 @@
/* $Id: tif_write.c,v 1.41 2015-06-07 22:53:17 bfriesen Exp $ */ /* $Id: tif_write.c,v 1.42 2015-06-07 23:00:23 bfriesen Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -115,6 +115,10 @@ TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
if (strip >= td->td_stripsperimage && imagegrew) if (strip >= td->td_stripsperimage && imagegrew)
td->td_stripsperimage = td->td_stripsperimage =
TIFFhowmany_32(td->td_imagelength,td->td_rowsperstrip); TIFFhowmany_32(td->td_imagelength,td->td_rowsperstrip);
if (td->td_stripsperimage == 0) {
TIFFErrorExt(tif->tif_clientdata, module, "Zero strips per image");
return (-1);
}
tif->tif_row = tif->tif_row =
(strip % td->td_stripsperimage) * td->td_rowsperstrip; (strip % td->td_stripsperimage) * td->td_rowsperstrip;
if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {