mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-28 10:11:58 +01:00
Camera raw files are TIFF-structured, so they reached the TIFF decoder. A raw image with the TIFF/EP CFA or DNG LinearRaw photometric interpretation failed with "Tiff: unknown photometric interpretation", a CR2 with "colour type YCbCr(8)", and a DNG or a raw whose sensor data sits in a SubIFD behind an RGB IFD0 quietly opened that small preview as if it were the photo. The TIFF decoder now checks the structure first (CR2 signature, DNGVersion tag, CFA / LinearRaw image in IFD0, its SubIFDs or the next IFDs; bounds-checked header reads only) and returns Unsupported: "camera raw files (such as CR2, NEF, ARW or DNG) are not supported". Ordinary TIFFs decode as before. Tests use tiny synthetic TIFFs with those markers, including truncations. Co-authored-by: storybored379 <storybored379@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>