1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 00:07:33 +00:00

getch2: Avoid possible infinite loop

If the first character is not a valid UTF-8 start code nor is in termcap,
getch2 would enter an infinite loop. Always walk 1 byte in the UTF-8 case
unless it's a valid start code.
This commit is contained in:
Diogo Franco (Kovensky) 2013-07-25 13:24:22 -03:00
parent 1aa0ad2725
commit ba95aed6f1

View File

@ -385,11 +385,11 @@ bool getch2(struct input_ctx *input_ctx)
if (utf8_len > 1) {
state = STATE_UTF8;
} else if (utf8_len == 1) {
continue;
} else if (utf8_len == 1)
mp_input_put_key(input_ctx, c);
walk_buf(1);
} else
walk_buf(getch2_pos);
walk_buf(1);
break;
}