🚨 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:
@@ -373,7 +373,7 @@ end;
|
||||
|
||||
function TLandscape.GetBlockSubscriptions(AX, AY: Word): TLinkedList;
|
||||
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]
|
||||
else
|
||||
Result := nil;
|
||||
@@ -384,7 +384,7 @@ var
|
||||
block: TMapBlock;
|
||||
begin
|
||||
Result := nil;
|
||||
if (AX >= 0) and (AX <= FCellWidth) and (AY >= 0) and (AY <= FCellHeight) then
|
||||
if (AX < FCellWidth) and (AY < FCellHeight) then
|
||||
begin
|
||||
block := GetMapBlock(AX div 8, AY div 8);
|
||||
if block <> nil then
|
||||
@@ -405,7 +405,7 @@ var
|
||||
block: TSeperatedStaticBlock;
|
||||
begin
|
||||
Result := nil;
|
||||
if (AX >= 0) and (AX <= FCellWidth) and (AY >= 0) and (AY <= FCellHeight) then
|
||||
if (AX < FCellWidth) and (AY < FCellHeight) then
|
||||
begin
|
||||
block := GetStaticBlock(AX div 8, AY div 8);
|
||||
if block <> nil then
|
||||
|
||||
Reference in New Issue
Block a user