AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2019.01.22 15:11 "[Tiff] Possible bug in libTiff 4.0.9?", by SM
2019.01.23 14:14 "Re: [Tiff] Possible bug in libTiff 4.0.9?", by Bob Friesenhahn
2019.01.23 14:43 "Re: [Tiff] Possible bug in libTiff 4.0.9?", by Even Rouault

2019.01.22 15:11 "[Tiff] Possible bug in libTiff 4.0.9?", by SM

Hello,

I have upgraded to TIFF 4.0.9 from 4.0.0 and I saw the following change in tif_write.c:

https://gitlab.kitware.com/third-party/tiff/commit/f0dd74c5e33be1f7f98a3b8d37cc71a889db9fe6?view=parallel

which fixes tif_encodestrip() and it returns -1 in case of failure as documented.

I believe this fix might have uncovered another bug in the library. I came across a special case while writing a YCbCr image which is JPEG compressed and contains a partial strip. The last strip could not be encoded successfully. I found that the failure is occurring in jpeg_write_raw_data in the JPEG library. It seems that the cinfo structure passed to the JPEG library from TIFF library contains incorrect dimensions of the strip if it is partial.

The buffer that is being passed to the library is of the same size as the whole strip (even in the case of a partial strip). In case of a partial strip, the rest of the buffer is filled with zeros.

Image details to be written:

'ImageWidth' - 3008

‘ImageLength’ - 1952

'Photometric' - YCbCr

'Compression' - JPEG

'BitsPerSample' - 8

'SamplesPerPixel' - 3

‘SampleFormat', - UInt

'PlanarConfiguration' - Chunky

'RowsPerStrip' - 256

'YCbCrSubSampling' - [2 1]

Can you please confirm if it is a bug?

Thanks,

Upanita