From c91c2a6e3fae7908ebe20952c6b3b6f61387a7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 7 Oct 2020 17:09:14 +0200 Subject: [PATCH] [app/shared] CurveView: Avoid dashSize overflow in drawHorizontalOrVerticalSegment --- apps/shared/curve_view.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index 186003521..ec745db4a 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -412,6 +412,10 @@ void CurveView::drawHorizontalOrVerticalSegment(KDContext * ctx, KDRect rect, Ax if (dashSize < 0) { // Continuous segment is equivalent to one big dash dashSize = end - start; + if (dashSize < 0) { + // end-start overflowed + dashSize = KDCOORDINATE_MAX; + } } KDRect lineRect = KDRectZero; for (KDCoordinate i = start; i < end; i += 2*dashSize) {