postgresql/src/backend/tsearch
Tom Lane eed245a113 Cope with more than 64K phrases in a thesaurus dictionary.
dict_thesaurus stored phrase IDs in uint16 fields, so it would get confused
and even crash if there were more than 64K entries in the configuration
file.  It turns out to be basically free to widen the phrase IDs to uint32,
so let's just do so.

This was complained of some time ago by David Boutin (in bug #7793);
he later submitted an informal patch but it was never acted on.
We now have another complaint (bug #11901 from Luc Ouellette) so it's
time to make something happen.

This is basically Boutin's patch, but for future-proofing I also added a
defense against too many words per phrase.  Note that we don't need any
explicit defense against overflow of the uint32 counters, since before that
happens we'd hit array allocation sizes that repalloc rejects.

Back-patch to all supported branches because of the crash risk.
2014-11-06 20:52:47 -05:00
..
dict.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dict_ispell.c Avoid memcpy() with same source and destination address. 2014-03-07 13:14:33 +02:00
dict_simple.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dict_synonym.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dict_thesaurus.c Cope with more than 64K phrases in a thesaurus dictionary. 2014-11-06 20:52:47 -05:00
hunspell_sample.affix Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
ispell_sample.affix Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
ispell_sample.dict Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
Makefile Update copyright for 2014 2014-01-07 16:05:30 -05:00
regis.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
spell.c Improve ispell dictionary's defenses against bad affix files. 2014-10-23 13:11:31 -04:00
synonym_sample.syn Add prefix support for synonym dictionary 2009-08-14 14:53:20 +00:00
thesaurus_sample.ths Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
to_tsany.c Use memmove() instead of memcpy() for copying overlapping regions. 2014-02-10 09:57:59 +02:00
ts_locale.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
ts_parse.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
ts_selfuncs.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
ts_typanalyze.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
ts_utils.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
wparser.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
wparser_def.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00