Project

General

Profile

Directory offset out of bounds?

Added by Jeroen Hegeman over 9 years ago

Dear Exiv2 experts,

First of all: thank you for this wonderful set of tools! I'm still new to digital photography but am impressed by some of the open source tools that are available!

But, I've got a question. Exiv2 complains about the jpegs coming off my Sony Alpha 580. Trying a simple 'exiv2 print file.jpg' tells me:
Error: Offset of directory Sony1, entry 0x2001 is out of bounds: Offset = 0x002a805e; truncating the entry

The actual information coming out appears to be fine, and for the corresponding RAW file I don't see any such complaint. If there is anyone who can tell me how to narrow this down further in order to find out what's wrong and where, that would be great.

Best regards,
Jeroen


Replies (4)

RE: Directory offset out of bounds? - Added by Andreas Huggel over 9 years ago

That's probably a shortcoming of Exiv2: It reads from JPEGs only what is officially the Exif segment and parses that. According to the Exif specification that is a self-contained block of information, however, some Makernotes contain pointers to locations outside of the Exif segment and the error that you encountered is generated if Exiv2 comes across such a pointer. It won't affect all the other information that Exiv2 reads from the Exif segment. It also doesn't happen in RAW files as these usually do not contain an Exif section and Exiv2 accesses the entire RAW image if necessary. It can however potentially mean that modifying the Exif data of such an image with Exiv2 will corrupt this part of the Makernote (the pointer may not be correct anymore after writing); that's the reason why the error is issued.

Unless you're a programmer and willing to improve how Exiv2 works in the described case, there is nothing you need to do about this. If the error bothers you, you can suppress it with the -q flag.

Andreas

RE: Directory offset out of bounds? - Added by Jeroen Hegeman over 9 years ago

Thanks Andreas,

After a bit of reading about the Exif and TIFF specs, I'm beginning to understand. It looks like each camera producer has 'improved upon' the standards in various ways. Exiv2's treatment looks correct to me, and I'll just ignore this message for the moment.

By the way: along the way I saw that exiftool has already managed to decoded this whole Sony1 data block. Now I'm curious, and I'll have a look at how complicate this stuff is.

Best regards,
Jeroen

RE: Directory offset out of bounds? - Added by Andreas Huggel over 9 years ago

Hi Jeroen,

Yes, Exiftool is amazingly powerful and complete. But Exiv2 also decodes the Sony1 IFD (look for Exif.Sony1.* tags in the output of exiv2 -pa), the error says only tag 0x2001 in this IFD is pointing outside of the Exif data block. It will be interesting to check this entry with Exiftool.

Andreas

RE: Directory offset out of bounds? - Added by Jeroen Hegeman over 9 years ago

Hi Andreas,

If I understand the exiftool documentation here: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Sony.html correctly, what lives at 0x2001 is the PreviewImage.

Exiv2 reports this as:
Exif.Sony1.PreviewImage Undefined 0

Exiftool reports this as:
Preview Image : (Binary data 240295 bytes, use -b option to extract)

I can easily imagine that Sony moves around this data block depending on the camera/sensor model.

Cheers,
Jeroen

    (1-4/4)