fpexif: Avoid crash when xmp data have trainling zero bytes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9024 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-11-13 17:35:49 +00:00
parent 3d9619fe06
commit 62f3c0a5cb
2 changed files with 10 additions and 1 deletions

View File

@ -661,7 +661,8 @@ begin
M_EOI, M_SOS:
break;
end;
AStream.Position := p + size;
p := p + Size;
AStream.Position := p;
end;
// Force writing of JFIF if it coexists with EXIF.

View File

@ -280,6 +280,14 @@ begin
FData[1] := '<';
end;
// The xml parser does not like zero bytes at the end --> remove them
i := Length(FData);
while (FData[i] = #0) and (i > 0) do
begin
dec(i);
SetLength(FData, i);
end;
AStream.Position := p;
CreateTags;
end;