Skip to content

Commit

Permalink
invalid read memory access #624
Browse files Browse the repository at this point in the history
  • Loading branch information
Caolán McNamara committed Nov 12, 2019
1 parent 30bd4bd commit ac938e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hunspell/suggestmgr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2040,7 +2040,7 @@ int SuggestMgr::leftcommonsubstring(
int l2 = su2.size();
// decapitalize dictionary word
if (complexprefixes) {
if (su1[l1 - 1] == su2[l2 - 1])
if (l1 && l2 && su1[l1 - 1] == su2[l2 - 1])
return 1;
} else {
unsigned short idx = su2.empty() ? 0 : (su2[0].h << 8) + su2[0].l;
Expand Down

2 comments on commit ac938e2

@kloczek
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any plans to make new release?

This fix seems is quite important.

@laszlonemeth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caolán, many thanks for your fix!

Kloczek: this is an almost artificial test case. None of the Hunspell dictionaries uses COMPLEXPREFIXES (see here: https://github.com/wooorm/dictionaries), also the bad UTF-8 input word is likely filtered out by the applications with embedded Hunspell.

Please sign in to comment.