git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: d900e19) | patch
Fix valgrind warning for btree_gist indexes on macaddr.
2014年5月16日 19:11:51 +0000 (15:11 -0400)
2014年5月16日 19:11:51 +0000 (15:11 -0400)
commit 82bbb60c30dbff0633da34387ccab58d843379b5
Fix valgrind warning for btree_gist indexes on macaddr.

The macaddr opclass stores two macaddr structs (each of size 6) in an
index column that's declared as being of type gbtreekey16, ie 16 bytes.
In the original coding this led to passing a palloc'd value of size 12
to the index insertion code, so that data would be fetched past the
end of the allocated value during index tuple construction. This makes
valgrind unhappy. In principle it could result in a SIGSEGV, though
with the current implementation of palloc there's no risk since
the 12-byte request size would be rounded up to 16 bytes anyway.

To fix, add a field to struct gbtree_ninfo showing the declared size of
the index datums, and use that in the palloc requests; and use palloc0
to be sure that any wasted bytes are cleanly initialized.

Per report from Andres Freund. No back-patch since there's no current
risk of a real problem.
15 files changed:
contrib/btree_gist/btree_cash.c diff | blob | blame | history
contrib/btree_gist/btree_date.c diff | blob | blame | history
contrib/btree_gist/btree_float4.c diff | blob | blame | history
contrib/btree_gist/btree_float8.c diff | blob | blame | history
contrib/btree_gist/btree_inet.c diff | blob | blame | history
contrib/btree_gist/btree_int2.c diff | blob | blame | history
contrib/btree_gist/btree_int4.c diff | blob | blame | history
contrib/btree_gist/btree_int8.c diff | blob | blame | history
contrib/btree_gist/btree_interval.c diff | blob | blame | history
contrib/btree_gist/btree_macaddr.c diff | blob | blame | history
contrib/btree_gist/btree_oid.c diff | blob | blame | history
contrib/btree_gist/btree_time.c diff | blob | blame | history
contrib/btree_gist/btree_ts.c diff | blob | blame | history
contrib/btree_gist/btree_utils_num.c diff | blob | blame | history
contrib/btree_gist/btree_utils_num.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /