mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 14:27:09 +00:00
Be more strict about invalid UTF-8.
This commit is contained in:
13
input.c
13
input.c
@ -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);
|
||||
|
Reference in New Issue
Block a user