🐛 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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user