summaryrefslogtreecommitdiff
path: root/libtiff/tif_thunder.c
diff options
context:
space:
mode:
authordron <dron>2004-09-19 10:08:38 +0000
committerdron <dron>2004-09-19 10:08:38 +0000
commitbfa5dd4a0cbafc5bdd85c889cb9990cb22cbe106 (patch)
tree20fd0e192c47c9dee777f281a2eecad5e6847485 /libtiff/tif_thunder.c
parenta39203d3436a72e139a062f858fea48dbfc73f7f (diff)
downloadlibtiff-bfa5dd4a0cbafc5bdd85c889cb9990cb22cbe106.tar.gz
Several buffer overruns fixed, as noted by Chris Evans.
Diffstat (limited to 'libtiff/tif_thunder.c')
-rw-r--r--libtiff/tif_thunder.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libtiff/tif_thunder.c b/libtiff/tif_thunder.c
index c7816498..a613a5ff 100644
--- a/libtiff/tif_thunder.c
+++ b/libtiff/tif_thunder.c
@@ -1,4 +1,4 @@
-/* $Id: tif_thunder.c,v 1.3 2004-09-14 06:42:55 dron Exp $ */
+/* $Id: tif_thunder.c,v 1.4 2004-09-19 10:08:38 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -91,8 +91,10 @@ ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
} else
lastpixel |= lastpixel << 4;
npixels += n;
- for (; n > 0; n -= 2)
- *op++ = (tidataval_t) lastpixel;
+ if (npixels < maxpixels) {
+ for (; n > 0; n -= 2)
+ *op++ = (tidataval_t) lastpixel;
+ }
if (n == -1)
*--op &= 0xf0;
lastpixel &= 0xf;