While processing TIFF data, we keep track of the offsets to IFDs that have already been processed in order to prevent endless loops when a file contains cycles.
The attached file uses the same TIFF IFD offset (432) from two different locations. In one case it's expected to contain ExifInteropDirectory data. In the other, it is expected to contain GpsDirectory data.
The interop directory is explored first, producing this:
[Interoperability] Unknown tag (0x0000) = 2 2 0 0
[Interoperability] Interoperability Index = Unknown (N)
[Interoperability] Interoperability Version = U3.?
[Interoperability] Unknown tag (0x0003) = W
[Interoperability] Unknown tag (0x0004) = 122/1 28/1 43799/1000
[Interoperability] Unknown tag (0x0005) = 1
[Interoperability] Unknown tag (0x0006) = 27999/10000
[Interoperability] Unknown tag (0x000a) = 2
[Interoperability] Unknown tag (0x000b) = 56929/10000
In reality, this directory contains GPS data and should be processed as:
[GPS] GPS Version ID = 2.200
[GPS] GPS Latitude Ref = N
[GPS] GPS Latitude = 37° 51' 15.14"
[GPS] GPS Longitude Ref = W
[GPS] GPS Longitude = -122° 28' 43.8"
[GPS] GPS Altitude Ref = Below sea level
[GPS] GPS Altitude = 2.8 metres
[GPS] GPS Measure Mode = 2-dimensional measurement
[GPS] GPS DOP = 5.69
We should make the loop prevention code tolerant of this scenario, so that GPS data from this file can be extracted, even though the file is arguably invalid.
While processing TIFF data, we keep track of the offsets to IFDs that have already been processed in order to prevent endless loops when a file contains cycles.
The attached file uses the same TIFF IFD offset (432) from two different locations. In one case it's expected to contain
ExifInteropDirectory
data. In the other, it is expected to containGpsDirectory
data.The interop directory is explored first, producing this:
In reality, this directory contains GPS data and should be processed as:
We should make the loop prevention code tolerant of this scenario, so that GPS data from this file can be extracted, even though the file is arguably invalid.