diff --git a/components/fpexif/fpeexifreadwrite.pas b/components/fpexif/fpeexifreadwrite.pas index 44b7439c6..11f350eae 100644 --- a/components/fpexif/fpeexifreadwrite.pas +++ b/components/fpexif/fpeexifreadwrite.pas @@ -352,16 +352,21 @@ begin Continue; end; + // Unexpected end of directory (4 zero bytes), so breaking here. + // see: https://bugs.freepascal.org/view.php?id=38904 if (ifdRec.TagID = 0) and (ifdRec.DataType = 0) then - // Unexpected end of directory (4 zero bytes), so breaking here. - // see: https://bugs.freepascal.org/view.php?id=38904 Break; ifdRec.TagID := FixEndian16(ifdRec.TagID); ifdRec.DataType := FixEndian16(ifdRec.DataType); - if not (ifdRec.DataType in [1..ord(High(TTagType))]) then begin + + // Illegal data type: https://forum.lazarus.freepascal.org/index.php/topic,68879.msg533245.html + // --> we skip this tag + if not (ifdRec.DataType in [1..ord(High(TTagType))]) then + begin Warning(Format(rsIncorrectTagType, [ifdRec.DataType, i, ifdRec.TagID, FImgInfo.Filename])); - break; + tagPos := tagPos + SizeOf(TIFDRecord); + Continue; end; ifdRec.DataCount := FixEndian32(ifdRec.DataCount);