pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Avoid formally-undefined use of memcpy() in hstoreUniquePairs().
Date: Sat, 25 Nov 2017 19:43:00 +0000
Message-ID: <E1eIgLs-0006zn-JY@gemulon.postgresql.org> (raw)

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

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5c38ddebd66bc239b23fe20d489fe03c9ebd4e28

Modified Files
--------------
contrib/hstore/hstore_io.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1eIgLs-0006zn-JY@gemulon.postgresql.org>
Permalink:  ../E1eIgLs-0006zn-JY@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eIgLs-0006zn-JY@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid formally-undefined use of memcpy() in hstoreUniquePairs().
  In-Reply-To: <E1eIgLs-0006zn-JY@gemulon.postgresql.org>
  References: <E1eIgLs-0006zn-JY@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox