Re: BUG #15150: Reading uninitialised value in NISortAffixes (tsearch/spell.c)

Artur Zakirov <a.zakirov@postgrespro.ru>

From: Arthur Zakirov <a.zakirov@postgrespro.ru>
To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2018-04-12T11:56:39Z
Lists: pgsql-bugs

Attachments

Hello,

> Bug reference:      15150
> Logged by:          Alexander Lakhin
> Email address:      exclusion@gmail.com
> PostgreSQL version: 10.3
> Operating system:   Debian-8
> Description:        
> 
> It looks that the following condition in NISortAffixes(IspellDict *Conf)
> uses uninitialised ptr->issuffix:
> 
>   if (ptr == Conf->CompoundAffix ||
>      ptr->issuffix != (ptr - 1)->issuffix ||
 
Yes, you are right. The second condition isn't right. Instead of
"ptr->issuffix != (ptr - 1)->issuffix" "Affix->type" should be checked
because we check for uniqueness of affixes.

The patch is attached.

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Commits

  1. Improve regression test coverage for src/backend/tsearch/spell.c.

  2. Fix bogus affix-merging code.