avoid errors on last partial strip (#1981)

This commit is contained in:
Frank Warmerdam 2008-12-21 20:13:38 +00:00
parent 203fc17cb4
commit 54bf10fcbc
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2008-12-21 Frank Warmerdam <warmerdam@pobox.com>
* 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 <warmerdam@pobox.com>
* libtiff/tif_flush.c: Make sure that BEENWRITING is cleared when

View File

@ -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)