AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.12.11 12:44 "[Tiff] [PATCH] LynxOS compile fixes", by Olli Savia
2005.12.12 09:21 "Re: [Tiff] [PATCH] LynxOS compile fixes", by Andrey Kiselev
2005.12.13 21:11 "RE: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Jason Frank
2005.12.13 19:53 "RE: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Jason Frank
2005.12.12 21:32 "[Tiff] Bug in tiffcp (unsupported codecs return 0)", by Jason Frank
2005.12.14 02:34 "RE: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Jason Frank
2005.12.13 20:09 "Re: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Andrey Kiselev
2005.12.13 21:46 "Re: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Andrey Kiselev
2005.12.13 23:32 "Re: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Edward Lam

2005.12.13 19:53 "RE: [Tiff] Bug in tiffcp (unsupported codecs return 0)", by Jason Frank

So, if I apply this patch to my tiffcp.c, it makes my test case work correctly:

--- ../tiff-3.7.4-orig/tools/tiffcp.c 2005-07-08 04:03:49.000000000

-0500

+++ tools/tiffcp.c      2005-12-13 10:45:23.000000000 -0600

@@ -852,8 +852,10 @@
(s = 0; s < ns; s++) { for

                        tsize_t cc = (row + rowsperstrip > imagelength)
?

TIFFVStripSize(in, imagelength - row):

stripsize;
if (TIFFReadEncodedStrip(in, s, buf, cc) < 0 -
&&

!ignore)
- break;
+ if (TIFFReadEncodedStrip(in, s, buf, cc) < 0 &&
!ignore) {

 +                         _TIFFfree(buf);

 +                         return FALSE;

+ }
                        if (TIFFWriteEncodedStrip(out, s, buf, cc) < 0)
{

_TIFFfree(buf);

return (FALSE);

This same issue appears to be present in all of the cpFunc's, athough all coded slightly differently. I suppose we could have to do they're

that to all the cpFuncs (and possibly some others...)

I'm worried that this is not the correct fix. Can someone tell me if
barking up the right tree? I'm

Also, I've noticed that when this happens, we do not unlink the new that we're creating (assuming that we're not appending.) That's a TIF

pretty easy fix. Any interest in doing that?

Jason

-----Original Message-----

From: tiff-bounces@lists.maptools.org

[mailto:tiff-bounces@lists.maptools.org] On Behalf Of Frank, Jason Sent: Monday, December 12, 2005 3:33 PM To: TIFF mailing list

Subject: Bug in tiffcp (unsupported codecs return 0) [Tiff]

Long time no post. Libtiff has been working entirely too well. Ran into something unusual today though. I'm using libtiff version 3.7.3. We need to tiffcp a bunch of single-page tiffs into multi-page tiffs. Normally, this isn't a problem, but somehow, some images that are Old-style JPEG compressed are in the mix.

Due to some constraints from some other software, I've intentionally left out Old-style JPEG support from my library. So, when we tiffcp these images, libtiff complains that there is no support for these images

"BWJ1Z38F.TIF: Old-style JPEG compression support is not configured."

That part is great, and I expect that. But tiffcp then produces the output TIF and exits with a return code of 0. I check the return code in my program, and assume everything worked well.

The problem is that the output TIF that was created is not a healthy one (as you can imagine.)

It would be nice if tiffcp were to return a non-zero status and possibly clean up the output file when it encounters codecs that it doesn't understand. Does anyone see any problem with that?

Jason

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/