QTiffHandler: fix nullptr deref on read() after certain failed read()s
It's probably an API misuse, but if a user called read() without
intervening jump*(), it will deref Private::tiff == nullptr:
first read()
readHeaders() sets headersRead = true;
~~~ failure, causing:
close() sets tiff = nullptr;
return false;
next read()
readHeaders() finds headersRead == true, returns true
read() calls TIFFIsTiled(tiff) while tiff == nullptr → Boom
The fact that makes this a problem in practice is that the nullptr
deref also happens if the user calls jumpToImage(current image
number). Added a corresponding AI-generated test case which crashes
without this fix.
Amends d2306d74850986692c02b70df0d7a6a6e933d0dc (5.9), which replaced
openForRead() in read() with readHeaders().
Pick-to: 6.12 6.11 6.8 6.5 5.15
Change-Id: I6088cc0f212a1a0b4482da9295736002b57714f2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>