Solving issue 2345: "Crash opening Pentax Q7 DNG files"

This commit is contained in:
Hombre
2014-04-17 21:36:49 +02:00
parent 3c93246050
commit a6d7f95673

View File

@@ -731,10 +731,11 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , sonyCameraSettingsAttribs3, INTEL); directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , sonyCameraSettingsAttribs3, INTEL);
else { else {
// Unknown CameraSettings // Unknown CameraSettings
delete directory; delete [] directory;
directory = NULL; directory = NULL;
type = INVALID;
} }
makerNoteKind = TABLESUBDIR; makerNoteKind = directory ? TABLESUBDIR : NOMK;
break; break;
case 0x9405: case 0x9405:
directory = new TagDirectory*[2]; directory = new TagDirectory*[2];
@@ -771,26 +772,28 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxSRInfo2Attribs, order); directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxSRInfo2Attribs, order);
else { else {
// Unknown SRInfo // Unknown SRInfo
delete directory; delete [] directory;
directory = NULL; directory = NULL;
type = INVALID;
} }
makerNoteKind = TABLESUBDIR; makerNoteKind = directory ? TABLESUBDIR : NOMK;
break; break;
case 0x0206: case 0x0206:
directory = new TagDirectory*[2]; directory = new TagDirectory*[2];
directory[1] = NULL; directory[1] = NULL;
if (count == 21) // AEInfo2 if (count == 21) // AEInfo2
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxAEInfo2Attribs, order); directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxAEInfo2Attribs, order);
else if (count == 48 || count == 34) // AEInfo3 (count == 34 actually is a hack for Issue 2345) else if (count == 48) // AEInfo3
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxAEInfo3Attribs, order); directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxAEInfo3Attribs, order);
else if (count <= 25) // AEInfo else if (count <= 25) // AEInfo
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxAEInfoAttribs, order); directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , pentaxAEInfoAttribs, order);
else { else {
// Unknown AEInfo // Unknown AEInfo
delete directory; delete [] directory;
directory = NULL; directory = NULL;
type = INVALID;
} }
makerNoteKind = TABLESUBDIR; makerNoteKind = directory ? TABLESUBDIR : NOMK;
break; break;
case 0x0207: case 0x0207:
{ // There are 2 format pentaxLensDataAttribs { // There are 2 format pentaxLensDataAttribs