2022.12.11 22:08 "Re: [Tiff] libtiff v4.5.0 release candidate available", by Christoph Gohlke
the issue is that the imagecodecs library was able read 65535 IFDs with libtiff 4.4 but only 65534 IFDs with libtiff 4.5. The library iterates through the first 65535 IFDs to read image properties and then iterates over those IFDs again to read the image data. The error occurs when changing from IFD 65534 (zero based index) to IFD 0 using TIFFSetDirectory since then the uint16 variable overflows.
I am OK if libtiff only officially supports 65534 IFDs, but I would expect in that case that `TIFFSetDirectory(tif, 65534)` would fail too. No?