fpexif: Fix exif reader stopping when a tag with illegal tag type (e.g. 0) is found (https://forum.lazarus.freepascal.org/index.php/topic,68879.msg533245.html)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9484 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
6f5ac5dcf0
commit
a18a305806
@ -352,16 +352,21 @@ begin
|
|||||||
Continue;
|
Continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (ifdRec.TagID = 0) and (ifdRec.DataType = 0) then
|
|
||||||
// Unexpected end of directory (4 zero bytes), so breaking here.
|
// Unexpected end of directory (4 zero bytes), so breaking here.
|
||||||
// see: https://bugs.freepascal.org/view.php?id=38904
|
// see: https://bugs.freepascal.org/view.php?id=38904
|
||||||
|
if (ifdRec.TagID = 0) and (ifdRec.DataType = 0) then
|
||||||
Break;
|
Break;
|
||||||
|
|
||||||
ifdRec.TagID := FixEndian16(ifdRec.TagID);
|
ifdRec.TagID := FixEndian16(ifdRec.TagID);
|
||||||
ifdRec.DataType := FixEndian16(ifdRec.DataType);
|
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]));
|
Warning(Format(rsIncorrectTagType, [ifdRec.DataType, i, ifdRec.TagID, FImgInfo.Filename]));
|
||||||
break;
|
tagPos := tagPos + SizeOf(TIFDRecord);
|
||||||
|
Continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ifdRec.DataCount := FixEndian32(ifdRec.DataCount);
|
ifdRec.DataCount := FixEndian32(ifdRec.DataCount);
|
||||||
|
Loading…
Reference in New Issue
Block a user