Hi,
When generating a navigation mesh for our game, I got an
AccessViolationException because Recast tried to access an index outside the
range of a data array.
The crash occured in the getHeight function in RecastMeshDetail.cpp:
int ix = (int)floorf(fx*ics + 0.01f);
int iz = (int)floorf(fz*ics + 0.01f);
ix = rcClamp(ix-hp.xmin, 0, hp.width);
iz = rcClamp(iz-hp.ymin, 0, hp.height);
unsigned short h = hp.data[ix+iz*hp.width];
iz was equal to hp.height.
Shouldn't the rcClamps clamp the ranges to the maximum value minus 1?
ix = rcClamp(ix-hp.xmin, 0, hp.width - 1);
iz = rcClamp(iz-hp.ymin, 0, hp.height - 1);
I changed it locally and the crash didn't occur again.
Original issue reported on code.google.com by coe...@googlemail.com on 27 Jun 2012 at 8:57
Original issue reported on code.google.com by
coe...@googlemail.com
on 27 Jun 2012 at 8:57