8000 Fix bogus affix-merging code. · MSPawanRanjith/postgres@f71d803 · GitHub
[go: up one dir, main page]

Skip to content

Commit f71d803

Browse files
committed
Fix bogus affix-merging code.
NISortAffixes() compared successive compound affixes incorrectly, thus possibly failing to merge identical affixes, or (less likely) merging ones that shouldn't be merged. The user-visible effects of this are unclear, to me anyway. Per bug #15150 from Alexander Lakhin. It's been broken for a long time, so back-patch to all supported branches. Arthur Zakirov Discussion: https://postgr.es/m/152353327780.31225.13445405496721177988@wrigleys.postgresql.org
1 parent 6943fb9 commit f71d803

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/tsearch/spell.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,16 +1370,18 @@ NISortAffixes(IspellDict *Conf)
13701370
if ((Affix->flagflags & FF_COMPOUNDFLAG) && Affix->replen > 0 &&
13711371
isAffixInUse(Conf, (char) Affix->flag))
13721372
{
1373+
bool issuffix = (Affix->type == FF_SUFFIX);
1374+
13731375
if (ptr == Conf->CompoundAffix ||
1374-
ptr->issuffix != (ptr - 1)->issuffix ||
1376+
issuffix != (ptr - 1)->issuffix ||
13751377
strbncmp((const unsigned char *) (ptr - 1)->affix,
13761378
(const unsigned char *) Affix->repl,
13771379
(ptr - 1)->len))
13781380
{
13791381
/* leave only unique and minimals suffixes */
13801382
ptr->affix = Affix->repl;
13811383
ptr->len = Affix->replen;
1382-
ptr->issuffix = (Affix->type == FF_SUFFIX) ? true : false;
1384+
ptr->issuffix = issuffix;
13831385
ptr++;
13841386
}
13851387
}

0 commit comments

Comments
 (0)
0