Forwardport r7822 by Buginator to trunk: Add ASSERT_OR_RETURN() to guard against buffer overflow.
(Real fix is still needed, and the cause is the unit is trying to build in a invalid area, and the path finding needs to be reset for the droid) ref ticket:698 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7845 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
76ee950a03
commit
0a5b68c4a1
|
@ -381,6 +381,7 @@ static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
|
|||
}
|
||||
else
|
||||
{
|
||||
ASSERT_OR_RETURN(false, psDroid->sMove.numPoints > 0, "Invalid point count for path");
|
||||
// align the formation with the last path of the route
|
||||
fmx2 = psDroid->sMove.asPath[psDroid->sMove.numPoints -1].x;
|
||||
fmy2 = psDroid->sMove.asPath[psDroid->sMove.numPoints -1].y;
|
||||
|
@ -393,6 +394,7 @@ static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
|
|||
}
|
||||
else
|
||||
{
|
||||
ASSERT_OR_RETURN(false, psDroid->sMove.numPoints > 1, "Invalid point count for path");
|
||||
fmx1 = psDroid->sMove.asPath[psDroid->sMove.numPoints -2].x;
|
||||
fmy1 = psDroid->sMove.asPath[psDroid->sMove.numPoints -2].y;
|
||||
fmx1 = world_coord(fmx1) + TILE_UNITS / 2;
|
||||
|
|
Loading…
Reference in New Issue