mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: fix stack corruption caused by out-of-scope variable usage
pmin and pmax pointed to these stack arrays, but these stack arrays were inside the loop while pmin and pmax, along with their usages were outside the scope of the loop causing undefined behavior when they pointed to the currently out-of-scope stack variables. Moved the arrays outside the loop so they remain valid up to the last point they are needed.
This commit is contained in:
parent
3e56daf398
commit
ec741313c2
@ -626,6 +626,9 @@ static bool createPolyMeshCells(const dtNavMeshCreateParams* params, rdTempVecto
|
||||
{
|
||||
bool onlyBoundary = false;
|
||||
|
||||
float storage[3][3];
|
||||
const float* v[3];
|
||||
|
||||
float dmin = FLT_MAX;
|
||||
float tmin = 0;
|
||||
const float* pmin = 0;
|
||||
@ -643,9 +646,6 @@ static bool createPolyMeshCells(const dtNavMeshCreateParams* params, rdTempVecto
|
||||
if (onlyBoundary && (tris[3] & ANY_BOUNDARY_EDGE) == 0)
|
||||
continue;
|
||||
|
||||
float storage[3][3];
|
||||
const float* v[3];
|
||||
|
||||
for (int m = 0; m < 3; ++m)
|
||||
{
|
||||
if (tris[m] < nv)
|
||||
|
Loading…
x
Reference in New Issue
Block a user