]> granicus.if.org Git - postgresql/commit
Initialize padding bytes in btree_gist varbit support.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 13 May 2014 11:16:28 +0000 (14:16 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 13 May 2014 12:27:43 +0000 (15:27 +0300)
commite31d77c96f665db24c165523a4b1b44728d185b4
tree5793afa6ecf72faddbdef541fe8db8a2f6d72e5d
parent8607099a19066927b1c2ee6311a8cf0a64192e07
Initialize padding bytes in btree_gist varbit support.

The code expands a varbit gist leaf key to a node key by copying the bit
data twice in a varlen datum, as both the lower and upper key. The lower key
was expanded to INTALIGN size, but the padding bytes were not initialized.
That's a problem because when the lower/upper keys are compared, the padding
bytes are used compared too, when the values are otherwise equal. That could
lead to incorrect query results.

REINDEX is advised for any btree_gist indexes on bit or bit varying data
type, to fix any garbage padding bytes on disk.

Per Valgrind, reported by Andres Freund. Backpatch to all supported
versions.
contrib/btree_gist/btree_bit.c