🚨 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;
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user