From 86b81dfbd168c726cea12b3b7a53290d4a05a3e6 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 20 Oct 2021 09:41:24 -0400 Subject: [PATCH] [sixel_refresh] bounds-check when damaging render state #2287 --- src/lib/sixel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 99215dab0..bdfdfd24f 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -388,9 +388,11 @@ void sixel_refresh(const ncpile* p, sprixel* s){ int idx = y * s->dimx + x; if(s->needs_refresh[idx]){ const int xx = absx + x; - int ridx = yy * p->dimx + xx; - struct crender *r = &p->crender[ridx]; - r->s.damaged = 1; + if(xx < p->dimx && yy < p->dimy){ + int ridx = yy * p->dimx + xx; + struct crender *r = &p->crender[ridx]; + r->s.damaged = 1; + } } } }