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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15150: Reading uninitialised value in NISortAffixes (tsearch/spell.c)
Date: 2018-04-12 22:14:03
Message-ID: 23884.1523571243@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-04-13 01:10:46 Re: BUG #15151: Error with wal replay after planned manual switchover.
Previous Message PG Bug reporting form 2018-04-12 12:20:09 BUG #15151: Error with wal replay after planned manual switchover.