Exception when exiv2 writes to this file
Added by Jonathan Potter almost 4 years ago
One of our users reported that the attached JPG can't be tagged.
It ends up throwing an exception in tags.cpp in the ExifKey constructor:
ExifKey::ExifKey(uint16_t tag, const std::string& groupName)
: p_(new Impl)
{
IfdId ifdId = groupId(groupName);
// Todo: Test if this condition can be removed
if (!Internal::isExifIfd(ifdId) && !Internal::isMakerIfd(ifdId)) {
--> throw Error(23, ifdId);
}
const TagInfo* ti = tagInfo(tag, ifdId);
if (ti == 0) {
throw Error(23, ifdId);
}
p_->groupName_ = groupName;
p_->makeKey(tag, ifdId, ti);
}
ifdId is equal to "lastId". I tried removing the condition as per the comment, but the tagInfo() call then returns null and the second exception is thrown instead :)
Replies (3)
RE: Exception when exiv2 writes to this file - Added by Robin Mills almost 4 years ago
Regrettably your file seems to be corrupted.
565 rmills@rmillsmbp:~/Downloads $ exiv2 -pa ~/Downloads/20180104_143102_001.jpg >/dev/null Warning: Directory Photo has an unexpected next pointer; ignored. Warning: Directory Photo, entry 0x0000 has unknown Exif (TIFF) type 0; setting type size 1. Error: Upper boundary of data for directory Photo, ... ... entry 0x0000 is out of bounds: Offset = 0x00000001, size = 303109, ... ... exceeds buffer size by 280109 Bytes; truncating the entry 566 rmills@rmillsmbp:~/Downloads $There is illegal data in the file which causes the lastId anomaly. You've correctly observed that there are two paths to throw Error(23). I believe the illegal Exif metadata is the true source of the issue with this file.
RE: Exception when exiv2 writes to this file - Added by Jonathan Potter almost 4 years ago
Ok, thanks! Will report this back to the user. Sorry for the spurious report.
RE: Exception when exiv2 writes to this file - Added by Robin Mills almost 4 years ago
It's always a pleasure to help my friends "Down Under" (I'm guessing from the image that you're in Australia).