diff options
Diffstat (limited to 'vui.c')
| -rw-r--r-- | vui.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; } |
