pgsql: Fix bogus code in contrib/ tsearch dictionary examples. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix bogus code in contrib/ tsearch dictionary examples.
Date
Msg-id E1RM6YT-0004qm-2m@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix bogus code in contrib/ tsearch dictionary examples.

Both dict_int and dict_xsyn were blithely assuming that whatever memory
palloc gives back will be pre-zeroed.  This would typically work for
just about long enough to run their regression tests, and no longer :-(.

The pre-9.0 code in dict_xsyn was even lamer than that, as it would
happily give back a pointer to the result of palloc(0), encouraging
its caller to access off the end of memory.  Again, this would just
barely fail to fail as long as memory contained nothing but zeroes.

Per a report from Rodrigo Hjort that code based on these examples
didn't work reliably.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0dddbbcd3178242f24d7476e12436ec7e1340f6d

Modified Files
--------------
contrib/dict_int/dict_int.c   |    2 +-
contrib/dict_xsyn/dict_xsyn.c |    8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix bogus code in contrib/ tsearch dictionary examples.
Next
From: Tom Lane
Date:
Subject: pgsql: Improve comments for TSLexeme data structure.