summaryrefslogtreecommitdiff
path: root/vui.c
diff options
context:
space:
mode:
authorWormHeamer2025-12-29 02:29:53 -0500
committerWormHeamer2025-12-29 02:29:53 -0500
commit4c5442ccd9428c4bb4e73939d3eff50911b574c0 (patch)
tree0b632c7786507178a48d62d0dcd090ae34d88c63 /vui.c
parente40c14f15bc8607717bd1955dc8df5180f36c90b (diff)
various asserts
Diffstat (limited to 'vui.c')
-rw-r--r--vui.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vui.c b/vui.c
index 8c4a58a..379fdb9 100644
--- a/vui.c
+++ b/vui.c
@@ -584,6 +584,7 @@ end:
}
void vui_chra(int x, int y, VuiChar c, VuiAttr a) {
+ ASSERT(c > 0 && c <= KEY_UTF8_MAX);
if (x >= 0 && x < (int)COLS && y >= 0 && y < (int)LINES) {
CHR(x, y) = c;
ATTR(x, y) = a;
@@ -617,7 +618,9 @@ void vui_putsna(int x, int y, const char *s, unsigned srcn, VuiAttr a) {
u32 n = utf8_decode_len(s, srcn);
truncate_span(&x, &n);
if (n < 1 || y < 0 || y >= (int)LINES) return;
- utf8_decode(&CHR(x, y), s, n);
+ VuiChar *dest = &CHR(x, y);
+ utf8_decode(dest, s, n);
+ for (u32 i = 0; i < n; i++) ASSERT(dest[i] > 0 && dest[i] <= KEY_UTF8_MAX);
for (uint16_t *pa = &ATTR(x, y); n--;) *pa++ = a;
}