avoid divide by zero in degenerate case (#2296)

This commit is contained in:
Frank Warmerdam 2011-02-23 21:57:59 +00:00
parent 91479f4d42
commit 010a264507
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2011-02-23 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_jpeg.c: avoid divide by zero in degenerate case (#2296)
* tools/tiff2rgba.c: close source file on error to make leak
detection easier.

View File

@ -1,4 +1,4 @@
/* $Id: tif_jpeg.c,v 1.100 2011-02-18 20:53:04 fwarmerdam Exp $ */
/* $Id: tif_jpeg.c,v 1.101 2011-02-23 21:58:00 fwarmerdam Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@ -1216,6 +1216,9 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
sp->src.next_input_byte = (const JOCTET*) tif->tif_rawcp;
sp->src.bytes_in_buffer = (size_t) tif->tif_rawcc;
if( sp->bytesperline == 0 )
return 0;
nrows = cc / sp->bytesperline;
if (cc % sp->bytesperline)
TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read");