From d3045de064c50ec5eb815e2b534062f7798f6319 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 15 Nov 2026 08:52:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Validate=20animation=20data=20lo?= =?UTF-8?q?okups=20against=20the=20entry=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Out-of-range IDs indexed the entry array unchecked and corrupted memory instead of failing. --- MulProvider/UAnimDataProvider.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MulProvider/UAnimDataProvider.pas b/MulProvider/UAnimDataProvider.pas index 1d121ad..bdcbff1 100644 --- a/MulProvider/UAnimDataProvider.pas +++ b/MulProvider/UAnimDataProvider.pas @@ -93,6 +93,8 @@ end; function TAnimDataProvider.GetData(AID, AOffset: Integer): TAnimData; begin + if (AID < 0) or (AID >= Length(FAnimData)) then + raise Exception.CreateFmt('Invalid animdata ID %d', [AID]); Result := FAnimData[AID]; end; @@ -114,6 +116,8 @@ end; procedure TAnimDataProvider.SetData(AID, AOffset: Integer; ABlock: TMulBlock); begin + if (AID < 0) or (AID >= Length(FAnimData)) then + raise Exception.CreateFmt('Invalid animdata ID %d', [AID]); FreeAndNil(FAnimData[AID]); FAnimData[AID] := TAnimData(ABlock.Clone); @@ -126,6 +130,8 @@ end; function TAnimDataProvider.GetBlock(AID: Integer): TAnimData; begin + if (AID < 0) or (AID >= Length(FAnimData)) then + raise Exception.CreateFmt('Invalid animdata ID %d', [AID]); Result := FAnimData[AID].Clone; end;