Core/MMaps: Fix infinite loop in Detour (ported commit: c602220e02bed1ad76c9e60064eeec5fd97bfe80)

This commit is contained in:
Ovahlord committed 2019-03-03 05:27:55 +01:00
1 parent b96f544f94
commit bd58cb3ab1
4 files changed
+18 -7

No files matched your search

+2 -1
View File
@@ -58,7 +58,8 @@ gSOAP (a portable development toolkit for C and C++ XML Web services and XML dat
recastnavigation (Recast is state of the art navigation mesh construction toolset for games) recastnavigation (Recast is state of the art navigation mesh construction toolset for games)
https://github.com/recastnavigation/recastnavigation https://github.com/recastnavigation/recastnavigation
Version: 2c85309280dbc9c82029e7ab16dfb01b9235c74e Version: 3a619d773deb7e3a15ee215217c825995fe71312
Custom changes: https://github.com/TrinityCore/recastnavigation/tree/3.3.5
StormLib (a pack of modules, written in C++, which are able to read and also to write files from/to the MPQ archives) StormLib (a pack of modules, written in C++, which are able to read and also to write files from/to the MPQ archives)
http://www.zezula.net/en/mpq/stormlib.html http://www.zezula.net/en/mpq/stormlib.html
@@ -226,7 +226,14 @@ bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b
// If point lies inside the triangle, return interpolated ycoord. // If point lies inside the triangle, return interpolated ycoord.
if (u >= epsilon && v >= epsilon && (u+v) <= denom - epsilon) { if (u >= epsilon && v >= epsilon && (u+v) <= denom - epsilon) {
h = a[1] + (v0[1]*u + v1[1]*v) / denom; if (denom == 0.f && u == 0.f && v == 0.f)
h = a[1];
else
h = a[1] + (v0[1] * u + v1[1] * v) / denom;
if (!dtMathIsfinite(h))
return false;
return true; return true;
} }
return false; return false;
@@ -1301,8 +1301,8 @@ dtStatus dtNavMeshQuery::initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef
m_query.raycastLimitSqr = FLT_MAX; m_query.raycastLimitSqr = FLT_MAX;
// Validate input // Validate input
if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) ||
|| !startPos || !dtVisfinite(startPos) || !startPos || !dtVisfinite(startPos) ||
!endPos || !dtVisfinite(endPos) || !filter) !endPos || !dtVisfinite(endPos) || !filter)
{ {
return DT_FAILURE | DT_INVALID_PARAM; return DT_FAILURE | DT_INVALID_PARAM;
+6 -3
View File
@@ -820,10 +820,12 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
dtPolyRef visited[MAX_VISIT_POLY]; dtPolyRef visited[MAX_VISIT_POLY];
uint32 nvisited = 0; uint32 nvisited = 0;
_navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &_filter, result, visited, (int*)&nvisited, MAX_VISIT_POLY); if (dtStatusFailed(_navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &_filter, result, visited, (int*)&nvisited, MAX_VISIT_POLY)))
return DT_FAILURE;
npolys = FixupCorridor(polys, npolys, MAX_PATH_LENGTH, visited, nvisited); npolys = FixupCorridor(polys, npolys, MAX_PATH_LENGTH, visited, nvisited);
_navMeshQuery->getPolyHeight(polys[0], result, &result[1]); if (dtStatusFailed(_navMeshQuery->getPolyHeight(polys[0], result, &result[1])))
return DT_FAILURE;
result[1] += 0.5f; result[1] += 0.5f;
dtVcopy(iterPos, result); dtVcopy(iterPos, result);
@@ -868,7 +870,8 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
} }
// Move position at the other side of the off-mesh link. // Move position at the other side of the off-mesh link.
dtVcopy(iterPos, connectionEndPos); dtVcopy(iterPos, connectionEndPos);
_navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1]); if (dtStatusFailed(_navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1])))
return DT_FAILURE;
iterPos[1] += 0.5f; iterPos[1] += 0.5f;
} }
} }