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: Cast to (void *) rather than (int *) when passing int64's to PQf
Date: Sun, 08 Mar 2015 17:58:47 +0000
Message-ID: <E1YUfTT-00080U-TJ@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Cast to (void *) rather than (int *) when passing int64's to PQfn().

This is a possibly-vain effort to silence a Coverity warning about
bogus endianness dependency.  The code's fine, because it takes care
of endianness issues for itself, but Coverity sees an int64 being
passed to an int* argument and not unreasonably suspects something's
wrong.  I'm not sure if putting the void* cast in the way will shut it
up; but it can't hurt and seems better from a documentation standpoint
anyway, since the pointer is not used as an int* in this code path.

Just for a bit of additional safety, verify that the result length
is 8 bytes as expected.

Back-patch to 9.3 where the code in question was added.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ef75508efc789c79c5a5d4acd7ad5da85f1e4f08

Modified Files
--------------
src/interfaces/libpq/fe-lobj.c |   10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (3+ messages)  latest in thread

Message-ID: <E1YUfTT-00080U-TJ@gemulon.postgresql.org>
Permalink:  ../E1YUfTT-00080U-TJ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YUfTT-00080U-TJ@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: Cast to (void *) rather than (int *) when passing int64's to PQf
  In-Reply-To: <E1YUfTT-00080U-TJ@gemulon.postgresql.org>
  References: <E1YUfTT-00080U-TJ@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