openpreserve / jpylyzer

JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
http://jpylyzer.openpreservation.org/
Other
69 stars 28 forks source link

Garbled sot info #187

Closed boxerab closed 2 years ago

boxerab commented 2 years ago

Offending image:

jpylyzer_bad_sot.zip

snippet from jpylyzer output :

       <tileParts>
            <tilePart>
                <sot>
                    <lsot>-9999</lsot>
                    <isot>-9999</isot>
                    <psot>-9999</psot>
                    <tpsot>-9999</tpsot>
                    <tnsot>-9999</tnsot>
                </sot>
            </tilePart>
        </tileParts>
bitsgalore commented 2 years ago

This doesn't look like a bug to me: the image is truncated immediately after the start of the SOT marker segment, which is why no meaningful values of lsot, isot, and so on can be read. This causes an exception in struct.unpack, which is handled by the bytestr conversion function, resulting in the "-9999" fallback values.

The validation output also provides several clues that something is seriously wrong with the image:

<tests>
    <siz>
        <rsizIsValid>False</rsizIsValid>
    </siz>
    <tileParts>
        <tilePart>
            <sot>
                <lsotIsValid>False</lsotIsValid>
                <isotIsValid>False</isotIsValid>
                <tpsotIsValid>False</tpsotIsValid>
            </sot>
            <foundSODMarker>False</foundSODMarker>
            <foundNextTilePartOrEOC>False</foundNextTilePartOrEOC>
        </tilePart>
    </tileParts>
    <foundEOCMarker>False</foundEOCMarker>
</tests>
boxerab commented 2 years ago

Yes, you're right. For some reason I though the SOT marker was intact. Closing.