|
|
e4d7d2 |
Partial fix for issues filed upstream at
|
|
|
e4d7d2 |
http://bugzilla.maptools.org/show_bug.cgi?id=2140
|
|
|
e4d7d2 |
This stops the tiffcmp core dump noted in bug #460322, but isn't enough
|
|
|
e4d7d2 |
to make tiffcmp return the right answer (it emits a bunch of error
|
|
|
e4d7d2 |
messages instead).
|
|
|
e4d7d2 |
|
|
|
e4d7d2 |
|
|
|
e4d7d2 |
diff -Naur tiff-3.9.2.orig/libtiff/tif_jpeg.c tiff-3.9.2/libtiff/tif_jpeg.c
|
|
|
e4d7d2 |
--- tiff-3.9.2.orig/libtiff/tif_jpeg.c 2009-08-30 12:21:46.000000000 -0400
|
|
|
e4d7d2 |
+++ tiff-3.9.2/libtiff/tif_jpeg.c 2010-01-05 22:40:40.000000000 -0500
|
|
|
e4d7d2 |
@@ -988,8 +988,15 @@
|
|
|
e4d7d2 |
tsize_t nrows;
|
|
|
e4d7d2 |
(void) s;
|
|
|
e4d7d2 |
|
|
|
e4d7d2 |
- /* data is expected to be read in multiples of a scanline */
|
|
|
e4d7d2 |
- if ( (nrows = sp->cinfo.d.image_height) ) {
|
|
|
e4d7d2 |
+ nrows = cc / sp->bytesperline;
|
|
|
e4d7d2 |
+ if (cc % sp->bytesperline)
|
|
|
e4d7d2 |
+ TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read");
|
|
|
e4d7d2 |
+
|
|
|
e4d7d2 |
+ if( nrows > (int) sp->cinfo.d.image_height )
|
|
|
e4d7d2 |
+ nrows = sp->cinfo.d.image_height;
|
|
|
e4d7d2 |
+
|
|
|
e4d7d2 |
+ /* data is expected to be read in multiples of a scanline */
|
|
|
e4d7d2 |
+ if (nrows) {
|
|
|
e4d7d2 |
/* Cb,Cr both have sampling factors 1, so this is correct */
|
|
|
e4d7d2 |
JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;
|
|
|
e4d7d2 |
int samples_per_clump = sp->samplesperclump;
|
|
|
e4d7d2 |
@@ -1087,8 +1094,7 @@
|
|
|
e4d7d2 |
* TODO: resolve this */
|
|
|
e4d7d2 |
buf += sp->bytesperline;
|
|
|
e4d7d2 |
cc -= sp->bytesperline;
|
|
|
e4d7d2 |
- nrows -= sp->v_sampling;
|
|
|
e4d7d2 |
- } while (nrows > 0);
|
|
|
e4d7d2 |
+ } while (--nrows > 0);
|
|
|
e4d7d2 |
|
|
|
e4d7d2 |
#ifdef JPEG_LIB_MK1
|
|
|
e4d7d2 |
_TIFFfree(tmpbuf);
|
|
|
e4d7d2 |
diff -Naur tiff-3.9.2.orig/libtiff/tif_strip.c tiff-3.9.2/libtiff/tif_strip.c
|
|
|
e4d7d2 |
--- tiff-3.9.2.orig/libtiff/tif_strip.c 2006-03-25 13:04:35.000000000 -0500
|
|
|
e4d7d2 |
+++ tiff-3.9.2/libtiff/tif_strip.c 2010-01-05 21:39:20.000000000 -0500
|
|
|
e4d7d2 |
@@ -238,23 +238,19 @@
|
|
|
e4d7d2 |
ycbcrsubsampling + 0,
|
|
|
e4d7d2 |
ycbcrsubsampling + 1);
|
|
|
e4d7d2 |
|
|
|
e4d7d2 |
- if (ycbcrsubsampling[0] == 0) {
|
|
|
e4d7d2 |
+ if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {
|
|
|
e4d7d2 |
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
|
|
|
e4d7d2 |
"Invalid YCbCr subsampling");
|
|
|
e4d7d2 |
return 0;
|
|
|
e4d7d2 |
}
|
|
|
e4d7d2 |
|
|
|
e4d7d2 |
- scanline = TIFFroundup(td->td_imagewidth,
|
|
|
e4d7d2 |
+ /* number of sample clumps per line */
|
|
|
e4d7d2 |
+ scanline = TIFFhowmany(td->td_imagewidth,
|
|
|
e4d7d2 |
ycbcrsubsampling[0]);
|
|
|
e4d7d2 |
- scanline = TIFFhowmany8(multiply(tif, scanline,
|
|
|
e4d7d2 |
- td->td_bitspersample,
|
|
|
e4d7d2 |
- "TIFFScanlineSize"));
|
|
|
e4d7d2 |
- return ((tsize_t)
|
|
|
e4d7d2 |
- summarize(tif, scanline,
|
|
|
e4d7d2 |
- multiply(tif, 2,
|
|
|
e4d7d2 |
- scanline / ycbcrsubsampling[0],
|
|
|
e4d7d2 |
- "TIFFVStripSize"),
|
|
|
e4d7d2 |
- "TIFFVStripSize"));
|
|
|
e4d7d2 |
+ /* number of samples per line */
|
|
|
e4d7d2 |
+ scanline = multiply(tif, scanline,
|
|
|
e4d7d2 |
+ ycbcrsubsampling[0]*ycbcrsubsampling[1] + 2,
|
|
|
e4d7d2 |
+ "TIFFScanlineSize");
|
|
|
e4d7d2 |
} else {
|
|
|
e4d7d2 |
scanline = multiply(tif, td->td_imagewidth,
|
|
|
e4d7d2 |
td->td_samplesperpixel,
|