]> granicus.if.org Git - postgresql/commit
Fix bogus code in contrib/ tsearch dictionary examples.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 Nov 2011 23:17:52 +0000 (19:17 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 Nov 2011 23:17:52 +0000 (19:17 -0400)
commit92375ed2bdea82cd223244cf74dff532dc776405
treed298fffec3c14b979e3c8cd698a8ef41e4618555
parent1819a375f117b8f98f6d4dd33bf53169e5e001ba
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.
contrib/dict_int/dict_int.c
contrib/dict_xsyn/dict_xsyn.c