Avoid formally-undefined use of memcpy() in hstoreUniquePairs().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 630aceda5be79551b6772ab230fddfc4edbb63eb
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2017-11-25T19:42:32Z
Releases: 9.6.7
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

Files

PathChange+/−
contrib/hstore/hstore_io.c modified +2 −1

Discussion

Cited messages not in the archive: bf84d940-90d4-de91-19dd-612e011007f4@fuzzy.cz