hyphen
hyphen copied to clipboard
possible bug in hyphen.c, when using Turkish dictionary
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 https://github.com/hunspell/hyphen/commit/73dd2967c8e1e4f6d7334ee9e539a323d6e66cbd, but it was never released. Try using latest git version.