since we load the fontmap from psf1 font files, we only have characters
for a maximum codepoint of 0xFFFF, so we save the char in an
unsigned short (16bit) but we decode up to 6 bytes of utf8
so we have to correctly bound check the assignment, else we can get
garbled characters on the terminal
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
vt->utf_char = (vt->utf_char << 6) | (c & 0x3f);
vt->utf_count--;
if (vt->utf_count == 0) {
- tc = vt->utf_char;
+ if (vt->utf_char <= USHRT_MAX) {
+ tc = vt->utf_char;
+ } else {
+ tc = 0;
+ }
} else {
continue;
}