hunspell / hyphen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

possible bug in hyphen.c, when using Turkish dictionary

aloistr opened this issue · comments

in hyphen.c line 869 offset = i + 1 - strlen (match);
I arrive with offset = -1;
This damages the alloc memory in line 888: matchrepl[offset + k] = repl;
because it writes to matchrepl[-1]
That leads later to a crash when free() is called.
I have fixed the problem by adding line 870: if (offset < 0) offset = 0;
but I am nor sure this is save.

The problem appears when I use a Turkish dictionary, and the error may caused by bad data in
the dictionary hyph_tr.dic from
https://github.com/Slyneth/hunspell-hyphenation-turkish

I believe this bug has already been fixed in 73dd296, but it was never released. Try using latest git version.