OSDN Git Service

Fix several bugs in tsvectorin, including crash due to uninitialized field and
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 23 Oct 2007 00:51:23 +0000 (00:51 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 23 Oct 2007 00:51:23 +0000 (00:51 +0000)
commitbb36c51fcdca16ad4dfd4c03e2673f2471c7e341
tree9dc4fdc1192918a076ef8f10f77f2126d4854280
parentf5513484171e26456a76a5cdeaad0dbf41980dd8
Fix several bugs in tsvectorin, including crash due to uninitialized field and
miscomputation of required palloc size.  The crash could only occur if the
input contained lexemes both with and without positions, which is probably not
common in practice.  The miscomputation would definitely result in wasted
space.  Also fix some inconsistent coding around alignment of strings and
positions in a tsvector value; these errors could also lead to crashes given
mixed with/without position data and a machine that's picky about alignment.
And be more careful about checking for overflow of string offsets.

Patch is only against HEAD --- I have not looked to see if same bugs are
in back-branch contrib/tsearch2 code.
src/backend/tsearch/to_tsany.c
src/backend/utils/adt/tsvector.c
src/backend/utils/adt/tsvector_op.c