From 762ecb5d79ab5b5a936ecb9141f9844cf7bc04a6 Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Sun, 8 Feb 2026 15:45:42 -0500 Subject: [PATCH] When attempting to add a span that is invalid (zero or negative size), log a warning and ignore the span. --- Recast/Source/RecastRasterization.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Recast/Source/RecastRasterization.cpp b/Recast/Source/RecastRasterization.cpp index d54ae720..c65d6ea0 100644 --- a/Recast/Source/RecastRasterization.cpp +++ b/Recast/Source/RecastRasterization.cpp @@ -195,6 +195,13 @@ bool rcAddSpan(rcContext* context, rcHeightfield& heightfield, { rcAssert(context); + // Span is zero size or inverted size. Ignore. + if (spanMin >= spanMax) + { + context->log(RC_LOG_WARNING, "rcAddSpan: Adding a span with zero or negative size. Ignored."); + return true; + } + if (!addSpan(heightfield, x, z, spanMin, spanMax, areaID, flagMergeThreshold)) { context->log(RC_LOG_ERROR, "rcAddSpan: Out of memory.");