diff --git a/components/fpexif/fpemetadata.pas b/components/fpexif/fpemetadata.pas index 478a3f799..162fa557a 100644 --- a/components/fpexif/fpemetadata.pas +++ b/components/fpexif/fpemetadata.pas @@ -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. diff --git a/components/fpexif/fpexmpdata.pas b/components/fpexif/fpexmpdata.pas index 09c280741..86045b2bf 100644 --- a/components/fpexif/fpexmpdata.pas +++ b/components/fpexif/fpexmpdata.pas @@ -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;