Hi,

I doubt you can use TIFFLIB_VERSION to check this as this number if only incremented at release time, so if you build from master, you'll get the version number of the last release.

Furthermore it is a bit weird you get this warning as the window to get it (for images not requiring more than 100 MB for TIFF tag content) only lasted a few hours on Oct 31 between commits 5320c9d89c054fa805d037d84c57da874470b01a and 0b025324711213a75e38b52f7e7ba60235f108aa

Regarding TIFFSizeProc, looking at its implementations shows that it returns the file size. For reading, we try to not use it too frequently because getting the file size could be a "costly" operation on unstandard file systems, but we may use it occasionally though. If you can't know the file size, you'd better return a huge value, like INT64_MAX, rather than 0. But looking at your example, it seems you read from a regular file, so you don't even need to implement a custom file handler and could just use TIFFOpen()

Even

Le 06/05/2024 à 12:03, Dmitry Karasik via Tiff a écrit :
Hello all,

My tiff loading code fails on latest kali-linux where if I try to load an image
from file stream and return 0 in a overloaded TIFFSizeProc [1]. I get warning
messages that say:

TIFFFetchDirectory: Warning, Requested memory size for TIFF directory of 156 is
greather than filesize 0. Memory not allocated, TIFF directory not read.
TIFFReadDirectory: Failed to read directory at offset 10.
and TIFFClientOpen returns an error.

I couldn't reproduce the error on my ubuntu with official tarballs (and neither
with git bisect but I didn't try too hard), but judging from the commit history,
that issue was quickly solved around 31 Oct 2023.

So my question is not really to fix that bug, as it seems to be already fixed
last year, but rather advise what would be the best action to take here - check
for TIFFLIB_VERSION is my code, report an upstream bug to kali, or something
else? The confusion stems from that on this official kali virtual box image,
where I could reproduce the bug, TIFFLIB_VERSION is 20230609 but the warning
appeared in the code in October 2023, and `dpkg -l` says 4.5.1+git230720-4`; --
three different dates. That would be easy to dismiss as a packager problem,
but probably you have experienced such problems before, so an advice would be
appreciated.

There could also be the case that I'm simply programming the library wrong by
returning 0 in TIFFSizeProc, and with the scarce documentation, I couldn't find
any definitive information about this. In any case, a small test case that
demonstrates the issue is here[2].

[1] https://github.com/dk/Prima/issues/115
[2] https://github.com/dk/Prima/files/15218524/libtiff-bug.tar.gz

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
Tiff mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/tiff

Reply via email to