summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfriesen <bfriesen>2015-06-07 23:00:23 +0000
committerbfriesen <bfriesen>2015-06-07 23:00:23 +0000
commit08584685d338ec3f835fb377fa8e4d313638198e (patch)
treecdaa270a237b86b40ef540eb5e0c72baff18e2e4
parent073bc69b0ee7274148dc5cfe590489f7a822d395 (diff)
downloadlibtiff-08584685d338ec3f835fb377fa8e4d313638198e.tar.gz
(TIFFWriteScanline): Fix Coverity 715979 "Division or modulo by
zero".
-rw-r--r--ChangeLog2
-rw-r--r--libtiff/tif_write.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 26dba457..56918fd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
or modulo by zero".
(TIFFWriteRawStrip): Fix Coverity 715978 "Division or modulo by
zero".
+ (TIFFWriteScanline): Fix Coverity 715979 "Division or modulo by
+ zero".
* libtiff/tif_read.c (TIFFStartTile): Fix Coverity 715973 and
715974 "Division or modulo by zero".
diff --git a/libtiff/tif_write.c b/libtiff/tif_write.c
index e84c879a..7996c31e 100644
--- a/libtiff/tif_write.c
+++ b/libtiff/tif_write.c
@@ -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
@@ -115,6 +115,10 @@ TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
if (strip >= td->td_stripsperimage && imagegrew)
td->td_stripsperimage =
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 =
(strip % td->td_stripsperimage) * td->td_rowsperstrip;
if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {