Skip to content

Commit bd676be

Browse files
Fix exiv2 -pR for Sony images (#1805)
`exiv2 -pR` failed to process Sony makernotes. Fix checks if makernotes header has Sony string, then uses correct offset. Fix supplied by @clanmills
1 parent 5dca23b commit bd676be

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/image.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,11 @@ namespace Exiv2 {
490490
seekOrThrow(io, offset, BasicIo::beg, kerCorruptedMetadata); // position
491491
readOrThrow(io, bytes, jump, kerCorruptedMetadata) ; // read
492492
bytes[jump]=0 ;
493-
if ( ::strcmp("Nikon",chars) == 0 ) {
493+
494+
bool bNikon = ::strcmp("Nikon" ,chars) == 0;
495+
bool bSony = ::strcmp("SONY DSC ",chars) == 0;
496+
497+
if ( bNikon ) {
494498
// tag is an embedded tiff
495499
const long byteslen = count-jump;
496500
DataBuf bytes(byteslen); // allocate a buffer
@@ -499,8 +503,9 @@ namespace Exiv2 {
499503
printTiffStructure(memIo,out,option,depth);
500504
} else {
501505
// tag is an IFD
506+
uint32_t punt = bSony ? 12 : 0 ;
502507
seekOrThrow(io, 0, BasicIo::beg, kerCorruptedMetadata); // position
503-
printIFDStructure(io,out,option,offset,bSwap,c,depth);
508+
printIFDStructure(io,out,option,offset+punt,bSwap,c,depth);
504509
}
505510

506511
seekOrThrow(io, restore, BasicIo::beg, kerCorruptedMetadata); // restore

0 commit comments

Comments
 (0)