Crash with empty dictionary - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Crash with empty dictionary
Date
Msg-id 46CB32E9.1040109@enterprisedb.com
Whole thread Raw
Responses Re: Crash with empty dictionary  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I'm fooling around with tsearch, and bumped into a segfault, when using
a custom ispell dictionary with DictFile pointing to an empty file.
NISortDictionary assumes there's at least one word in the dictionary,
and crashes on line 941:

>     Conf->AffixData[1] = pstrdup(Conf->Spell[0]->p.flag);

I'm not sure if this is a sane way to set up a dictionary, but surely
seg faulting is not the right thing to do. Should we throw an error on
an empty dict file, or should we swallow it without crashing?

--  Heikki Linnakangas EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: A couple of tsearch loose ends
Next
From: Andrew Chernow
Date:
Subject: PGparam extension version 0.4