Re: BUG #16337: Finnish Ispell dictionary cannot be created - Mailing list pgsql-bugs

From Artur Zakirov
Subject Re: BUG #16337: Finnish Ispell dictionary cannot be created
Date
Msg-id 7ce82fff-5368-47b8-671e-31ea340b0cde@gmail.com
Whole thread Raw
In response to Re: BUG #16337: Finnish Ispell dictionary cannot be created  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-bugs
Hello Horiguchi-san,

On 4/13/2020 5:36 PM, Kyotaro Horiguchi wrote:
> Looking man 5 ispell, "Any character with special meaning to parser
> can be changed to an uniterpreted token by backslashing it". It
> depends on how we sholud be strict on that, but I think it is safer
> that we think that any character prefixed by a backslash is an word
> character.  (I don't understand how '-' can be in a word by the
> definition in the .affix file, though.)
> 
> Since a escaped character is intended to be a part of a word, there's
> no point in identifying minus-sign ad-hockerly, I think.

Thank you to pay attention to the patch.

I don't mind if the patch will work in more broad cases. But I tested 
ispell utility with other characters other than '-' before. It seems 
that it ignores such affixes or doesn't work properly. But in general 
maybe it is better to stick closer with the man page description.

I attached new version of the patch. It fixes only PAE_INFIND and 
PAE_INREPL cases. I think we shouldn't allow to escape all cases and it 
is safer to have some exceptions:
- In PAE_WAIT_MASK we shouldn't escape comment string which starts with '#'
- PAE_INMASK case is handled by regcomp.c separately and maybe it is 
better to leave the string as-is
- PAE_WAIT_FIND can start only with '-'
- I don't think that there is a sense in escaping PAE_WAIT_REPL

And in PAE_INFIND and PAE_INREPL I think we shouldn't allow to escape 
',' and '#'.

The condition:

if (t_iseq(str, '\\') && !isescaped &&
    (state == PAE_INFIND || state == PAE_INREPL))

maybe is not great, but I cannot come up with a better solution.

-- 
Artur

Attachment

pgsql-bugs by date:

Previous
From: ChiJin Zhou
Date:
Subject: Buffer overflow when continuously send SIGHUP to postgres
Next
From: Thomas Munro
Date:
Subject: Re: backend crash