This part does index--; to move the index to the previous character (to cancel the effect of the last get_next_char() call), but this will be incorrect for non-ASCII characters.
To avoid the (relatively) complex index manipulation on UTF-8 string, the patch counts the consumed (hex)digit characters and uses it to advance the index, instead of relying entirely on get_next_char() to manipulate index.
Tested in my environment and the MRE succeeded as expected.
Summary
libskk crashes when the dictionaries contain the entry that satisfies the condition below:
concat
function and has hexadecimal or octal escape (such as\050
and\x40
), andReproducible using
skk
command andfcitx5-skk
.Minimal Reproducible Example
dict.skkdict:
command:
Fix
https://github.com/ueno/libskk/blob/d7c3293ac6770b92f671d501cc8c3fd83eef783d/libskk/expr.vala#L85-L101
This part does
index--;
to move the index to the previous character (to cancel the effect of the lastget_next_char()
call), but this will be incorrect for non-ASCII characters. To avoid the (relatively) complex index manipulation on UTF-8 string, the patch counts the consumed (hex)digit characters and uses it to advance the index, instead of relying entirely onget_next_char()
to manipulate index.Tested in my environment and the MRE succeeded as expected.