diff options
author | dron <dron> | 2004-09-19 10:08:38 +0000 |
---|---|---|
committer | dron <dron> | 2004-09-19 10:08:38 +0000 |
commit | bfa5dd4a0cbafc5bdd85c889cb9990cb22cbe106 (patch) | |
tree | 20fd0e192c47c9dee777f281a2eecad5e6847485 /libtiff/tif_thunder.c | |
parent | a39203d3436a72e139a062f858fea48dbfc73f7f (diff) | |
download | libtiff-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.c | 8 |
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; |