mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
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
This commit is contained in:
parent
b8ca984b2c
commit
65a69dfa08
@ -1963,8 +1963,10 @@ NISortAffixes(IspellDict *Conf)
|
|||||||
if ((Affix->flagflags & FF_COMPOUNDFLAG) && Affix->replen > 0 &&
|
if ((Affix->flagflags & FF_COMPOUNDFLAG) && Affix->replen > 0 &&
|
||||||
isAffixInUse(Conf, Affix->flag))
|
isAffixInUse(Conf, Affix->flag))
|
||||||
{
|
{
|
||||||
|
bool issuffix = (Affix->type == FF_SUFFIX);
|
||||||
|
|
||||||
if (ptr == Conf->CompoundAffix ||
|
if (ptr == Conf->CompoundAffix ||
|
||||||
ptr->issuffix != (ptr - 1)->issuffix ||
|
issuffix != (ptr - 1)->issuffix ||
|
||||||
strbncmp((const unsigned char *) (ptr - 1)->affix,
|
strbncmp((const unsigned char *) (ptr - 1)->affix,
|
||||||
(const unsigned char *) Affix->repl,
|
(const unsigned char *) Affix->repl,
|
||||||
(ptr - 1)->len))
|
(ptr - 1)->len))
|
||||||
@ -1972,7 +1974,7 @@ NISortAffixes(IspellDict *Conf)
|
|||||||
/* leave only unique and minimals suffixes */
|
/* leave only unique and minimals suffixes */
|
||||||
ptr->affix = Affix->repl;
|
ptr->affix = Affix->repl;
|
||||||
ptr->len = Affix->replen;
|
ptr->len = Affix->replen;
|
||||||
ptr->issuffix = (Affix->type == FF_SUFFIX);
|
ptr->issuffix = issuffix;
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user