🐛 Free the art decode buffer on malformed data
The constructor leaked its temporary stream whenever a decode operation raised, for example on truncated or corrupt art data.
This commit is contained in:
+4
-1
@@ -91,6 +91,7 @@ begin
|
||||
begin
|
||||
AData.Position := AIndex.Lookup;
|
||||
block := TMemoryStream.Create;
|
||||
try
|
||||
block.CopyFrom(AData, AIndex.Size);
|
||||
block.Position := 0;
|
||||
|
||||
@@ -195,7 +196,9 @@ begin
|
||||
PWordArray(FGraphic.Bits)^[i] := PWordArray(FGraphic.Bits)^[i] xor $8000; //invert alpha bit
|
||||
end else
|
||||
FGraphic:= TSingleImage.Create;
|
||||
if Assigned(block) then block.Free;
|
||||
finally
|
||||
block.Free;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
FHeader := 1;
|
||||
|
||||
Reference in New Issue
Block a user