From: Ben Harris Date: Sun, 16 Nov 2025 13:54:31 +0000 (+0000) Subject: Add assertions that we don't overflow the "points" array X-Git-Tag: bedstead-3.261~20 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=ce6d060613b78441df931c294712e8622096a297;p=bedstead.git Add assertions that we don't overflow the "points" array --- 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;