FLI/FLC _accept: Check for 8-bit colour depth

Standard FLI/FLC files always have 8-bit color depth.
This change helps avoid erroneously detecting some TIFFs as FLI/FLC
files.

Update test files
Tests/images/timeout-9139147ce93e20eb14088fe238e541443ffd64b3.fli and
Tests/images/timeout-bff0a9dc7243a8e6ede2408d2ffa6a9964698b87.fli
to claim to have 8-bit colour depth so that the tests related to them
will still work.
This commit is contained in:
Ville-Pekka Vainio 2025-08-20 12:12:30 +03:00
parent 9f5d1f71a0
commit 583c33c9f7
3 changed files with 1 additions and 0 deletions

View File

@ -32,6 +32,7 @@ def _accept(prefix: bytes) -> bool:
return ( return (
len(prefix) >= 6 len(prefix) >= 6
and i16(prefix, 4) in [0xAF11, 0xAF12] and i16(prefix, 4) in [0xAF11, 0xAF12]
and i16(prefix, 12) == 8 # 8-bit colour
and i16(prefix, 14) in [0, 3] # flags and i16(prefix, 14) in [0, 3] # flags
) )