diff --git a/src/exif.cpp b/src/exif.cpp index c63a2e2d..8c84e3d5 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -1122,9 +1122,10 @@ namespace Exiv2 { break; } // Make sure that the size of the Exifdatum fits the available size - // of the entry + // of the entry and the types are the same if ( md->size() > rc.second->size() - || md->sizeDataArea() > rc.second->sizeDataArea()) { + || md->sizeDataArea() > rc.second->sizeDataArea() + || md->typeId() != rc.second->type()) { compatible = false; break; } diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index bee83f03..3925e08c 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -54,6 +54,14 @@ num=447 # Problem only visible in Valgrind filename=`prep_file $num` $binpath/exiv2 -pi $filename +num=452 +filename=exiv2-bug$num.jpg +cp -f ../data/exiv2-empty.jpg $filename +$binpath/exiv2 -v -M"set Exif.GPSInfo.GPSLatitude SRational -1/3 -2/3 -3/3" $filename +$binpath/exiv2 -pv $filename +$binpath/exiv2 -v -M"set Exif.GPSInfo.GPSLatitude Rational 1/3 2/3 3/3" $filename +$binpath/exiv2 -pv $filename + num=460 filename=`prep_file $num` $binpath/exiv2 -pt $filename diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out index e80dd289..ecd28dc4 100644 --- a/test/data/bugfixes-test.out +++ b/test/data/bugfixes-test.out @@ -210,6 +210,14 @@ 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 +File 1/1: exiv2-bug452.jpg +Set Exif.GPSInfo.GPSLatitude "-1/3 -2/3 -3/3" (SRational) +0x8825 Image GPSTag Long 1 26 +0x0002 GPSInfo GPSLatitude SRational 3 -1/3 -2/3 -3/3 +File 1/1: exiv2-bug452.jpg +Set Exif.GPSInfo.GPSLatitude "1/3 2/3 3/3" (Rational) +0x8825 Image GPSTag Long 1 26 +0x0002 GPSInfo GPSLatitude Rational 3 1/3 2/3 3/3 ------> Bug 460 <------- Exif.Image.XPTitle Byte 40 Titel und ähnliches Exif.Image.XPComment Byte 46 And a standard comment