pgsql: Fix bogus code in contrib/ tsearch dictionary examples.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix bogus code in contrib/ tsearch dictionary examples.
Date: 2011-11-03 23:18:41
Message-ID: E1RM6YT-0004qd-4I@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e3e3087d8717c26cd1c4581ba29274ac214eb816

Modified Files
--------------
contrib/dict_int/dict_int.c | 2 +-
contrib/dict_xsyn/dict_xsyn.c | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2011-11-04 02:36:27 pgsql: Unbreak isolationtester on Win32
Previous Message Tom Lane 2011-11-03 23:18:40 pgsql: Improve comments for TSLexeme data structure.