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

2019.01.23 14:43 "Re: [Tiff] Possible bug in libTiff 4.0.9?", by Even Rouault

On mercredi 23 janvier 2019 08:14:38 CET Bob Friesenhahn wrote:

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.

Does your application provide a full last-strip to libtiff? With JPEG, it has always been required that the strip-size be a multiple of 8 or 16, depending on the sub-sampling, with a multiple of 16 being a safe choice. The last strip provided to libtiff needs to be a full strip just like the other strips.

Bob,

I'm not sure about that. I believe on the contrary that the last strip must only contain the remaining number of rows. That's what tiffcp does (see https://gitlab.com/libtiff/libtiff/blob/master/tools/tiffcp.c#L1005 )

https://www.awaresystems.be/imaging/tiff/specification/TIFF6.pdf also mentions at page 19 for RowsPerStrip

"""The number of rows in each strip (except possibly the last strip.) For example, if ImageLength is 24, and RowsPerStrip is 10, then there are 3 strips, with 10 rows in the first strip, 10 rows in the second strip, and 4 rows in the third strip. (The data in the last strip is not padded with 6 extra rows of dummy data.)"""

The JPEG codec has a protection on the writing side to avoid writing too much lines. Was added per https://gitlab.com/libtiff/libtiff/commit/ 54bf10fcbcb22c397f42cb1693df8ac6abbb3ac8

(This is the contrary of a tiled TIFF, where the right most and bottom most tile must be full tiles)

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com