diff options
author | nicm <nicm> | 2015-11-14 10:56:31 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-11-14 10:56:31 +0000 |
commit | 64333e3ef89047d1c09cdc5053af647dbd8344da (patch) | |
tree | 99b3efed938dd8499c791ce04830ec738b87041c /input.c | |
parent | c56b81a2ce815f6d289232f20bb6e07cfd0e36ec (diff) | |
download | rtmux-64333e3ef89047d1c09cdc5053af647dbd8344da.tar.gz rtmux-64333e3ef89047d1c09cdc5053af647dbd8344da.tar.bz2 rtmux-64333e3ef89047d1c09cdc5053af647dbd8344da.zip |
Be more strict about invalid UTF-8.
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -446,11 +446,11 @@ const struct input_transition input_state_ground_table[] = { { 0x1c, 0x1f, input_c0_dispatch, NULL }, { 0x20, 0x7e, input_print, NULL }, { 0x7f, 0x7f, NULL, NULL }, - { 0x80, 0xc1, input_print, NULL }, + { 0x80, 0xc1, NULL, NULL }, { 0xc2, 0xdf, input_utf8_open, &input_state_utf8_one }, { 0xe0, 0xef, input_utf8_open, &input_state_utf8_two }, { 0xf0, 0xf4, input_utf8_open, &input_state_utf8_three }, - { 0xf5, 0xff, input_print, NULL }, + { 0xf5, 0xff, NULL, NULL }, { -1, -1, NULL, NULL } }; @@ -1923,7 +1923,8 @@ input_utf8_open(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; - utf8_open(ud, ictx->ch); + if (!utf8_open(ud, ictx->ch)) + log_fatalx("UTF-8 open invalid %#hhx", ictx->ch); log_debug("%s %hhu", __func__, ud->size); @@ -1936,7 +1937,8 @@ input_utf8_add(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; - utf8_append(ud, ictx->ch); + if (utf8_append(ud, ictx->ch) != 1) + log_fatalx("UTF-8 add invalid %#hhx", ictx->ch); log_debug("%s", __func__); @@ -1949,7 +1951,8 @@ input_utf8_close(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; - utf8_append(ud, ictx->ch); + if (utf8_append(ud, ictx->ch) != 0) + log_fatalx("UTF-8 close invalid %#hhx", ictx->ch); log_debug("%s %hhu '%*s' (width %hhu)", __func__, ud->size, (int)ud->size, ud->data, ud->width); |