]> granicus.if.org Git - postgresql/commit
Avoid formally-undefined use of memcpy() in hstoreUniquePairs().
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 25 Nov 2017 19:42:10 +0000 (14:42 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 25 Nov 2017 19:42:46 +0000 (14:42 -0500)
commit6e9ac0a2e2a62449f0c1a89563f80b7bb71c6121
tree0b69407bb32114e5a9c5e826f8ea5da467050ca7
parentd538f65684a50214240b26f39d1062e9800139dd
Avoid formally-undefined use of memcpy() in hstoreUniquePairs().

hstoreUniquePairs() often called memcpy with equal source and destination
pointers.  Although this is almost surely harmless in practice, it's
undefined according to the letter of the C standard.  Some versions of
valgrind will complain about it, and some versions of libc as well
(cf. commit ad520ec4a).  Tweak the code to avoid doing that.

Noted by Tomas Vondra.  Back-patch to all supported versions because
of the hazard of libc assertions.

Discussion: https://postgr.es/m/bf84d940-90d4-de91-19dd-612e011007f4@fuzzy.cz
contrib/hstore/hstore_io.c