Bug #407
Writing metadata back to image after intrusive change looses thumbnail
0%
Description
Read Exif data, add a tag (or make any other "intrusive change", write data back. The resulting Exif data has a corrupt JPEGInterchangeFormat offset.
The problem arises because
void addToIfd(Ifd& ifd, const Exifdatum& md, ByteOrder byteOrder)
writes the original absolute offset to the new Ifd entry and in
Entry::setDataAreaOffsets
it is assumed to be an offset relative to the start of the data.
Additional information:
Simple reproducer:
#include "exif.hpp"
int main(int argc, char* const argv[])
{
if (argc != 2) {
std::cout << "Usage: " << argv0 << " file\n";
return 1;
}
Exiv2::ExifData exifData;
exifData.read(argv1);
exifData["Exif.GPSInfo.GPSAltitude"] = Exiv2::URational(400, 1);
exifData.write(argv1);
return rc;
}