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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Arthur Zakirov <a.zakirov@postgrespro.ru>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2018-04-12T22:14:03Z
Lists: pgsql-bugs
Arthur Zakirov <a.zakirov@postgrespro.ru> writes:
>> 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.

Yeah, existing code is clearly wrong, patch looks OK, will push.

But I see from the code coverage report that this bit is unexercised
in the regression tests.  Any chance of getting a test that covers
this?  I'm worried that this means we also lack any coverage of
cases where the CompoundAffix array has more than one entry.

			regards, tom lane


Commits

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

  2. Fix bogus affix-merging code.