🐛 Validate tiledata lookups against the entry count

Out-of-range tile IDs indexed past the arrays and read arbitrary
memory instead of failing.
This commit is contained in:
2026-11-15 22:06:51 +01:00
parent 6229d296df
commit 9ed3862b4a
+2
View File
@@ -176,6 +176,8 @@ end;
function TTiledataProvider.GetTileData(AID: Integer): TTiledata; function TTiledataProvider.GetTileData(AID: Integer): TTiledata;
begin begin
if (AID < 0) or (AID >= $4000 + Integer(FStaticCount)) then
raise Exception.CreateFmt('Invalid tiledata ID %d', [AID]);
if AID < $4000 then if AID < $4000 then
Result := FLandTiles[AID] Result := FLandTiles[AID]
else else