]> git.ipfire.org Git - thirdparty/postgresql.git/commit
hstore: Fix NULL pointer dereference with receive function
authorMichael Paquier <michael@paquier.xyz>
Mon, 16 Feb 2026 23:41:35 +0000 (08:41 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 16 Feb 2026 23:41:35 +0000 (08:41 +0900)
commit63c05e03bcc5e927a3f3f2b283af6f38b9eeb0aa
treec425db08d4fde556e1674a7d5f355fc740592d55
parent899de38d8f3b519e7fd5b2acf580d1c9282ee6f1
hstore: Fix NULL pointer dereference with receive function

The receive function of hstore was not able to handle correctly
duplicate key values when a new duplicate links to a NULL value, where a
pfree() could be attempted on a NULL pointer, crashing due to a pointer
dereference.

This problem would happen for a COPY BINARY, when stacking values like
that:
aa => 5
aa => null

The second key/value pair is discarded and pfree() calls are attempted
on its key and its value, leading to a pointer dereference for the value
part as the value is NULL.  The first key/value pair takes priority when
a duplicate is found.

Per offline report.

Reported-by: "Anemone" <vergissmeinnichtzh@gmail.com>
Reported-by: "A1ex" <alex000young@gmail.com>
Backpatch-through: 14
contrib/hstore/hstore_io.c