From ce6d060613b78441df931c294712e8622096a297 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 16 Nov 2025 13:54:31 +0000 Subject: [PATCH] Add assertions that we don't overflow the "points" array --- bedstead.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bedstead.c b/bedstead.c index 172492b..52afbb3 100644 --- a/bedstead.c +++ b/bedstead.c @@ -4366,6 +4366,7 @@ moveto(int x, int y) { struct point *p = &points[nextpoint++]; + assert(nextpoint <= MAXPOINTS); p->v.x = x; p->v.y = y; p->next = p->prev = NULL; } @@ -4375,6 +4376,7 @@ lineto(int x, int y) { struct point *p = &points[nextpoint++]; + assert(nextpoint <= MAXPOINTS); p->v.x = x; p->v.y = y; p->next = NULL; p->prev = p - 1; -- 2.30.2