Skip to content

Big-endian bigTIFF breaks #129

@j-hudecek

Description

@j-hudecek

I have a tiff that starts with

4D 4D 00 2B 00 08 00 00 00 00 00 00 00 00 00 10

So, MM for big-endian, 43 for big tiff, 08 for magic and 0x10 for offset to first dir.

libtiff.net fails on this with "Can not read TIFF directory count".

Stepping through the code it reads the header with tiff_diroff=0x800 and then it messes it up even more in SwabBigTiffValue.
Wouldn't it better to read the header correctly immediately instead of trying to fix it up later? I.e. in readHeaderOk as soon as we read MM as tiff_magic we know all multibyte reads are big-endian. So when we read 0x2B00 don't store that in tiff_version but flip the bytes so that we don't miss the important further logic in readHeaderOk about bigTIFF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions