#816 Correction to r4018 to deal with segmentation fault on test file _IGP9034.JPG

v0.27.3
Robin Mills 10 years ago
parent fe0a04cd3b
commit c6ed7dfe35

@ -1152,9 +1152,16 @@ namespace Exiv2 {
const ExifData* metadata)
{
try {
unsigned long lensID = value.toLong(0)*256 + value.toLong(1);
unsigned long lensID = value.toLong(0)*256 + value.toLong(1); // 0x3ff
unsigned long index = 0;
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end()
? metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo"))
: metadata->findKey(ExifKey("Exif.Pentax.LensInfo"))
;
if ( lensInfo == metadata->end() ) return EXV_PRINT_COMBITAG_MULTI(pentaxLensType, 2, 1, 2)(os, value, metadata);
if ( lensInfo->count() < 5 ) return EXV_PRINT_COMBITAG_MULTI(pentaxLensType, 2, 1, 2)(os, value, metadata);
if ( value.count() == 2 ) {
// http://dev.exiv2.org/attachments/download/326/IMGP4432.PEF
// exiv2 -pv --grep Lens ~/Downloads/IMGP4432.PEF
@ -1164,25 +1171,20 @@ namespace Exiv2 {
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensData
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.Pentax.LensInfo"));
if ( lensInfo->count() > 5 ) {
unsigned int autoAperture = lensInfo->toLong(base+1) & 0x01 ;
unsigned int minAperture = lensInfo->toLong(base+2) & 0x06 ;
unsigned int minFocusDistance = lensInfo->toLong(base+3) & 0xf8 ;
unsigned int dontKnow = lensInfo->toLong(base+4);
if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && dontKnow == 148) index = 8;
}
} else if ( value.count() == 3 ) {
// http://dev.exiv2.org/attachments/download/858/_IGP9032.DNG
// $ exiv2 -pv --grep Lens ~/Downloads/_IGP9032.DNG
// 0x003f PentaxDng LensType Byte 3 3 255 0
// 0x0207 PentaxDng LensInfo Undefined 69 131 0 0 255 0 40 148 68 244 ...
// 0 1 2 3 4 5 6
const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo"));
if ( lensInfo->count() > 5 ) {
if ( lensInfo->toLong(4) == 0 && lensInfo->toLong(5) == 40 && lensInfo->toLong(6) == 148 ) index = 8;
}
}
if ( index > 0 ) {
const TagDetails* td = find(pentaxLensType, lensID);

@ -222,10 +222,10 @@ source ./functions.source
num=816 # test Camera: Pentax + Lens:Sigma 55-200mm F4-5.6 DC is correctly reported
printf "$num " >&3
echo '------>' Bug $num '<-------' >&2
for X in a b; do
file=exiv2-bug${num}${X}.exv
copyTestFile $file
runTest exiv2 -pa --grep Lens $file
for X in a b c d; do
filename=exiv2-bug${num}${X}.exv
copyTestFile $filename
runTest exiv2 -pa --grep Lens $filename
done
num=831

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save