AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2020.12.01 20:44 "[Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Nalini Vishnoi
2020.12.01 21:35 "Re: [Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Even Rouault
2020.12.08 15:27 "Re: [Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Even Rouault
2020.12.08 15:29 "Re: [Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Even Rouault
2020.12.08 19:51 "Re: [Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Nalini Vishnoi
2020.12.08 21:04 "Re: [Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Even Rouault
2020.12.11 01:00 "Re: [Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Nalini Vishnoi

2020.12.01 20:44 "[Tiff] Question about difference in TIFFReadEncodedStrip behavior between libtiff versions", by Nalini Vishnoi

Hello Tiff team,

I encountered a difference in behavior of "TIFFReadEncodedStrip" function between v4.0.0 and v4.0.10 when reading a 25MB TIFF file. Please note the file has a single strip as an image.

I understand that a lot of code changes have been made to this function between these two library versions, however, in the older version 4.0.0, I am able to read the file but with the newer version 4.0.10, I get an error:

------tiff 4.0.0-----
% ./a.out

TIFFReadDirectoryCheckOrder: Warning, Invalid TIFF directory; tags are not sorted in ascending order.
TIFFReadDirectory: Warning, Bogus "StripByteCounts" field, ignoring and calculating from imagelength.

Size of strip=25725440
Status after reading the image=25725440

------tiff 4.0.10-----
% ./a.out

TIFFReadDirectoryCheckOrder: Warning, Invalid TIFF directory; tags are not sorted in ascending order.
TIFFReadDirectory: Warning, Bogus "StripByteCounts" field, ignoring and calculating from imagelength.

TIFFFillStrip: Read error on strip 0; got 80392 bytes, expected 25725440.
Size of strip=25725440
Status after reading the image=-1

I have attached the reproduction code to my mail. Is this a bug in the newer releases or an expected behavior?

Please note that the TIFF file itself is 25MB in size and is confidential in nature. What would be the best way to provide access to that TIFF file for testing?

Thanks and regards,

Nalini

#include <tiffio.h>
#include <iostream>
#include <vector>

int main()
{
    TIFF *tif=TIFFOpen("20200203_103013_copy.tif", "r");
      int64 status;

    std::vector<uint16> raster;
    TIFF_SSIZE_T sz = TIFFStripSize(tif);
   std::cout<<"\nSize of strip="<<sz;

    raster.resize(sz);
    // Read the first strip
    status = TIFFReadEncodedStrip(tif, 0, (uint16 *)(&raster[0]), -1);
       std::cout<<"\nStatus after reading the image="<<status;
 TIFFClose(tif);
}