diff --git a/ChangeLog b/ChangeLog index 0a4610ff..4b6dce2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-12-21 Frank Warmerdam + + * libtiff/tif_jpeg.c: Avoid errors if the application writes a full + strip for the last partial strip in a jpeg compressed file. + http://bugzilla.maptools.org/show_bug.cgi?id=1981 + 2008-10-29 Frank Warmerdam * libtiff/tif_flush.c: Make sure that BEENWRITING is cleared when diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c index 4e992854..407fb668 100644 --- a/libtiff/tif_jpeg.c +++ b/libtiff/tif_jpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_jpeg.c,v 1.77 2008-10-10 01:48:36 fwarmerdam Exp $ */ +/* $Id: tif_jpeg.c,v 1.78 2008-12-21 20:13:38 fwarmerdam Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler @@ -1723,6 +1723,10 @@ JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) if (cc % sp->bytesperline) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded"); + /* The last strip will be limited to image size */ + if( !isTiled(tif) && tif->tif_row + nrows > tif->tif_dir.td_imagelength ) + nrows = tif->tif_dir.td_imagelength - tif->tif_row; + while (nrows-- > 0) { bufptr[0] = (JSAMPROW) buf; if (TIFFjpeg_write_scanlines(sp, bufptr, 1) != 1)