AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2017.02.27 23:48 "[Tiff] Possible undefined behaviour in library", by Aaron Boxer
2017.02.27 23:49 "Re: [Tiff] Possible undefined behaviour in library", by Aaron Boxer
2017.02.28 18:12 "Re: [Tiff] Possible undefined behaviour in library", by Aaron Boxer

2017.02.27 23:48 "[Tiff] Possible undefined behaviour in library", by Aaron Boxer

Greetings,

I have what I think to be a case of UB in libtiff. Here is my evidence:

I am on Windows, Visual Studio 2015, working with a mono tiff with alpha channel and ICC profile:

https://github.com/GrokImageCompression/grok-test-data/blob/master/input/ nonregression/basn4a08.tif

I execute the following steps:

Step 1: lossless compress to jpeg 2000 using Grok codec

Step 2: decompress back to TIFF using Grok codec

Step 3: compare to original using GraphicsMagick

$ gm compare original.tif round_trip.tif -metric PSNR

For step 2, if Grok is running in debug mode, then the round trip image is identical

to the original, as reported by GraphicsMagick.

But, if Grok is running in release mode, then the alpha channels differ. PSNR for alpha channel is around 4.8.

Now, you might think this is a bug in Grok. That's what I assumed at first.

But then I decompressed the same jp2 file to TIFF with kdu_expand. And that TIFF file also did not match original, AND the PSNR on the alpha channel

was the same as the PSNR from Grok in release mode.

So, what is common between the two binaries? My guess is: libtiff.

So, what is the best way to trouble shoot this problem?

Thanks,

Aaron