From 603dc88e5d7fb0b1c273cff14bbdbf01506b7700 Mon Sep 17 00:00:00 2001 From: Anton Matveev Date: Mon, 3 Jul 2023 05:42:37 +0500 Subject: [PATCH 02/36] Bounds checks were unnecessary inclusive. (#418) Co-authored-by: Graham Pentheny --- Recast/Source/RecastArea.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Recast/Source/RecastArea.cpp b/Recast/Source/RecastArea.cpp index 07fb021..45406dc 100644 --- a/Recast/Source/RecastArea.cpp +++ b/Recast/Source/RecastArea.cpp @@ -493,7 +493,7 @@ int rcOffsetPoly(const float* verts, const int nverts, const float offset, if (bevel && cross < 0.0f) { - if (n+2 >= maxOutVerts) + if (n+2 > maxOutVerts) return 0; float d = (1.0f - (dx0*dx1 + dy0*dy1))*0.5f; outVerts[n*3+0] = vb[0] + (-dlx0+dx0*d)*offset; @@ -507,7 +507,7 @@ int rcOffsetPoly(const float* verts, const int nverts, const float offset, } else { - if (n+1 >= maxOutVerts) + if (n+1 > maxOutVerts) return 0; outVerts[n*3+0] = vb[0] - dmx*offset; outVerts[n*3+1] = vb[1]; -- 2.43.0