1 From e2fe9f86e1769b440972971240e9b8fb1cd53b97 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Fri, 6 Jan 2023 16:20:45 +0000
4 Subject: [PATCH] Resolves: rhbz#2158548 allow longer words for hunspell-ko
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 https://github.com/hunspell/hunspell/issues/903
11 A problem since the sanity check added in:
13 commit 05e44e069e4cfaa9ce1264bf13f23fc9abd7ed05
14 Author: Caolán McNamara <caolanm@redhat.com>
15 Date: Thu Sep 1 13:46:40 2022 +0100
17 Check word limit (#813)
19 * check against hentry blen max
21 src/hunspell/hashmgr.cxx | 6 +++---
22 src/hunspell/htypes.hxx | 4 ++--
23 tests/korean.dic | 3 ++-
24 3 files changed, 7 insertions(+), 6 deletions(-)
26 diff --git a/src/hunspell/hashmgr.cxx b/src/hunspell/hashmgr.cxx
27 index 100916d..14201e9 100644
28 --- a/src/hunspell/hashmgr.cxx
29 +++ b/src/hunspell/hashmgr.cxx
30 @@ -209,7 +209,7 @@ int HashMgr::add_word(const std::string& in_word,
34 - if (word->size() > std::numeric_limits<unsigned char>::max()) {
35 + if (word->size() > std::numeric_limits<unsigned short>::max()) {
36 HUNSPELL_WARNING(stderr, "error: word len %ld is over max limit\n", word->size());
39 @@ -235,8 +235,8 @@ int HashMgr::add_word(const std::string& in_word,
41 int i = hash(hpw, word->size());
43 - hp->blen = (unsigned char)word->size();
44 - hp->clen = (unsigned char)wcl;
45 + hp->blen = (unsigned short)word->size();
46 + hp->clen = (unsigned short)wcl;
50 diff --git a/src/hunspell/htypes.hxx b/src/hunspell/htypes.hxx
51 index 44366b1..2b896fb 100644
52 --- a/src/hunspell/htypes.hxx
53 +++ b/src/hunspell/htypes.hxx
58 - unsigned char blen; // word length in bytes
59 - unsigned char clen; // word length in characters (different for UTF-8 enc.)
60 + unsigned short blen; // word length in bytes
61 + unsigned short clen; // word length in characters (different for UTF-8 enc.)
62 short alen; // length of affix flag vector
63 unsigned short* astr; // affix flag vector
64 struct hentry* next; // next word with same hash code
65 diff --git a/tests/korean.dic b/tests/korean.dic
66 index 95cb450..d76ea05 100644
67 --- a/tests/korean.dic
68 +++ b/tests/korean.dic
74 +김수한무거북이와두루미삼천갑자동방삭치치카포사리사리세ᅡ워리워리세브리캉무드셀ᅡ구름위허ᅵ케ᅵᆫᅦ담벼락서생원에ᄀ양