diff --git a/src/ifd.cpp b/src/ifd.cpp index ccedce0c..7531d5db 100644 --- a/src/ifd.cpp +++ b/src/ifd.cpp @@ -431,6 +431,16 @@ namespace Exiv2 { // Set the offset to the data, relative to start of IFD e.setOffset(tmpOffset - offset_); // Set the size to at least for bytes to accomodate offset-data +#ifndef SUPPRESS_WARNINGS + if (i->type_ < 1 || i->type_ > 10 || i->type_ == 6) { + std::cerr << "Warning: " + << ExifTags::ifdName(ifdId_) << " tag 0x" + << std::setw(4) << std::setfill('0') << std::hex + << i->tag_ << " has invalid Exif type " + << std::dec << i->type_ + << "; using 7 (undefined).\n"; + } +#endif e.setValue(i->type_, i->count_, buf + start + e.offset(), std::max(long(4), i->size_)); this->add(e); diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index 3725f687..5cd7028d 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -45,6 +45,10 @@ num=445 filename=`prep_file $num` $binpath/exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename $binpath/exiv2 -pt $filename +filename=exiv2-empty.jpg +cp -f ../data/$filename . +$binpath/exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename +$binpath/exiv2 -pt $filename num=447 # Problem only visible in Valgrind filename=`prep_file $num` diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out index 098173a7..02466a17 100644 --- a/test/data/bugfixes-test.out +++ b/test/data/bugfixes-test.out @@ -201,7 +201,12 @@ Exif.Thumbnail.YResolution Rational 1 180 Exif.Thumbnail.ResolutionUnit Short 1 inch Exif.Thumbnail.JPEGInterchangeFormat Long 1 0 Exif.Thumbnail.JPEGInterchangeFormatLength Long 1 5448 +File 1/1: exiv2-empty.jpg +Set Exif.Photo.UserComment "A comment" (Comment) +Exif.Image.ExifTag Long 1 26 +Exif.Photo.UserComment Undefined 17 A comment ------> Bug 447 <------- +Warning: Exif tag 0x9286 has invalid Exif type 14; using 7 (undefined). Iptc.Application2.Caption String 0 Iptc.Application2.DateCreated Date 8 2005-08-09 Iptc.Application2.TimeCreated Time 11 01:28:31-07:00