🚨 Reject out-of-range block subscriptions

The off-by-one bounds check let a crafted free-block packet index
one past the subscription array and follow garbage memory as a
client list, corrupting the heap.
This commit is contained in:
2026-11-15 22:08:32 +01:00
parent 0a939d4f35
commit e74065fd49
+3 -3
View File
@@ -373,7 +373,7 @@ end;
function TLandscape.GetBlockSubscriptions(AX, AY: Word): TLinkedList; function TLandscape.GetBlockSubscriptions(AX, AY: Word): TLinkedList;
begin begin
if (AX >= 0) and (AX <= FWidth) and (AY >= 0) and (AY <= FHeight) then if (AX < FWidth) and (AY < FHeight) then
Result := FBlockSubscriptions[(AY * FWidth) + AX] Result := FBlockSubscriptions[(AY * FWidth) + AX]
else else
Result := nil; Result := nil;
@@ -384,7 +384,7 @@ var
block: TMapBlock; block: TMapBlock;
begin begin
Result := nil; Result := nil;
if (AX >= 0) and (AX <= FCellWidth) and (AY >= 0) and (AY <= FCellHeight) then if (AX < FCellWidth) and (AY < FCellHeight) then
begin begin
block := GetMapBlock(AX div 8, AY div 8); block := GetMapBlock(AX div 8, AY div 8);
if block <> nil then if block <> nil then
@@ -405,7 +405,7 @@ var
block: TSeperatedStaticBlock; block: TSeperatedStaticBlock;
begin begin
Result := nil; Result := nil;
if (AX >= 0) and (AX <= FCellWidth) and (AY >= 0) and (AY <= FCellHeight) then if (AX < FCellWidth) and (AY < FCellHeight) then
begin begin
block := GetStaticBlock(AX div 8, AY div 8); block := GetStaticBlock(AX div 8, AY div 8);
if block <> nil then if block <> nil then