From 32c38041db4bf4f6f566089fef0cdb0a37bd7bbe Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 22 May 2025 16:05:04 +0900 Subject: [PATCH] sw_engine: added diagnostics for potential issues --- src/renderer/sw_engine/tvgSwRle.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/renderer/sw_engine/tvgSwRle.cpp b/src/renderer/sw_engine/tvgSwRle.cpp index de9112a6..82a9bdf2 100644 --- a/src/renderer/sw_engine/tvgSwRle.cpp +++ b/src/renderer/sw_engine/tvgSwRle.cpp @@ -758,7 +758,11 @@ static SwSpan* _intersectSpansRegion(const SwRle *clip, const SwRle *target, SwS //Try clipping with all clip spans which have a same y-coordinate. auto temp = clipSpans; - while(temp < clipEnd && outSpansCnt > 0 && temp->y == clipSpans->y) { + while(temp < clipEnd && temp->y == clipSpans->y) { + if (outSpansCnt == 0) { + TVGERR("SW_ENGINE", "span buffer is over."); + break; + } auto sx1 = spans->x; auto sx2 = sx1 + spans->len; auto cx1 = temp->x;