(TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo by

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

View File

@ -4,6 +4,8 @@
"Division or modulo by zero". "Division or modulo by zero".
(TIFFWriteEncodedTile): Fix Coverity 715976 and 715977 "Division (TIFFWriteEncodedTile): Fix Coverity 715976 and 715977 "Division
or modulo by zero". or modulo by zero".
(TIFFWriteRawStrip): Fix Coverity 715978 "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.40 2015-06-07 22:47:29 bfriesen Exp $ */ /* $Id: tif_write.c,v 1.41 2015-06-07 22:53:17 bfriesen Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -316,6 +316,10 @@ TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
return ((tmsize_t) -1); return ((tmsize_t) -1);
} }
tif->tif_curstrip = strip; tif->tif_curstrip = strip;
if (td->td_stripsperimage == 0) {
TIFFErrorExt(tif->tif_clientdata, module,"Zero strips per image");
return ((tmsize_t) -1);
}
tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip; tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
return (TIFFAppendToStrip(tif, strip, (uint8*) data, cc) ? return (TIFFAppendToStrip(tif, strip, (uint8*) data, cc) ?
cc : (tmsize_t) -1); cc : (tmsize_t) -1);