comparison src/libvterm/src/encoding.c @ 13186:dc39ef257b60 v8.0.1467

patch 8.0.1467: libvterm doesn't handle illegal byte sequence correctly commit https://github.com/vim/vim/commit/fef4ddd5eb8816a6607a624aa401bcfa71a63def Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 4 14:49:57 2018 +0100 patch 8.0.1467: libvterm doesn't handle illegal byte sequence correctly Problem: Libvterm doesn't handle illegal byte sequence correctly. Solution: After the invalid code check if there is space to store another character. Allocate one more character. (zhykzhykzhyk, closes #2614, closes #2613)
author Christian Brabandt <cb@256bit.org>
date Sun, 04 Feb 2018 15:00:04 +0100
parents 562fa0b252c5
children 2449b6ce1456
comparison
equal deleted inserted replaced
13185:13fed273cfd6 13186:dc39ef257b60
44 44
45 if(c < 0x20) /* C0 */ 45 if(c < 0x20) /* C0 */
46 return; 46 return;
47 47
48 else if(c >= 0x20 && c < 0x7f) { 48 else if(c >= 0x20 && c < 0x7f) {
49 if(data->bytes_remaining) 49 if(data->bytes_remaining) {
50 cp[(*cpi)++] = UNICODE_INVALID; 50 data->bytes_remaining = 0;
51 51 cp[(*cpi)++] = UNICODE_INVALID;
52 if (*cpi >= cplen)
53 break;
54 }
52 cp[(*cpi)++] = c; 55 cp[(*cpi)++] = c;
53 #ifdef DEBUG_PRINT_UTF8 56 #ifdef DEBUG_PRINT_UTF8
54 printf(" UTF-8 char: U+%04x\n", c); 57 printf(" UTF-8 char: U+%04x\n", c);
55 #endif 58 #endif
56 data->bytes_remaining = 0;
57 } 59 }
58 60
59 else if(c == 0x7f) /* DEL */ 61 else if(c == 0x7f) /* DEL */
60 return; 62 return;
61 63