AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2022.04.05 13:26 "[Tiff] Reading miscoded custom field array via libtiff", by Paavo
2022.04.05 14:49 "Re: [Tiff] Reading miscoded custom field array via libtiff", by Rob Tillaart
2022.04.05 19:57 "Re: [Tiff] Reading miscoded custom field array via libtiff", by Paavo

2022.04.05 13:26 "[Tiff] Reading miscoded custom field array via libtiff", by Paavo

Hi libtiff gurus, I have stuck on a nasty problem. We need to add support for reading some proprietary TIFF files containing some binary integer arrays in custom extension tags. The problem is they have not followed the TIFF standard for encoding the array length and thus the arrays are actually twice longer in the file than is known to libtiff, so when I read them in I only get first half of the array.

No problem, I thought: I get the value count and pointer to raw data out of the TIFFGetField(), and then just multiply this value count by 2 before reading in the raw data array. Alas, this does not work, it appears libtiff has copied the array away somewhere else, so I get just garbage if I attempt to read more than the official length. Hence my question: is it possible to somehow read in twice the data from the original array location inside the file, or to otherwise convince libtiff somehow that the array is twice larger than encoded in the IFD entry?

TIA

Paavo