From 1335e3f40e764f33d3573719fdcfef104a34cf5a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 15 Nov 2026 09:09:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Validate=20tile=20and=20hue=20ID?= =?UTF-8?q?s=20from=20network=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Static materials indexed the tiledata array and hue table with unchecked IDs from the server, crashing the client on malformed packets. --- Client/ULandscape.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Client/ULandscape.pas b/Client/ULandscape.pas index 2cf76fa..8ed08c2 100644 --- a/Client/ULandscape.pas +++ b/Client/ULandscape.pas @@ -464,11 +464,14 @@ var staticTiledata: TStaticTiledata; hue: THue; begin + if (AStaticItem.TileID < 0) or + (AStaticItem.TileID >= Integer(ResMan.Tiledata.StaticCount)) then + raise Exception.CreateFmt('Invalid static tile ID %d', [AStaticItem.TileID]); staticTiledata := ResMan.Tiledata.StaticTiles[AStaticItem.TileID]; if AOverrideHue < 0 then AOverrideHue := AStaticItem.Hue; - if AOverrideHue > 0 then + if (AOverrideHue > 0) and (AOverrideHue <= ResMan.Hue.Count) then hue := ResMan.Hue.Hues[AOverrideHue - 1] else hue := nil;