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@lists.postgresql.org
Subject: pgsql: Fix misuse of an integer as a bool.
Date: Mon, 13 May 2019 14:53:33 +0000
Message-ID: <E1hQCKb-0007ie-O9@gemulon.postgresql.org> (raw)

Fix misuse of an integer as a bool.

pgtls_read_pending is declared to return bool, but what the underlying
SSL_pending function returns is a count of available bytes.

This is actually somewhat harmless if we're using C99 bools, but in
the back branches it's a live bug: if the available-bytes count happened
to be a multiple of 256, it would get converted to a zero char value.
On machines where char is signed, counts of 128 and up could misbehave
as well.  The net effect is that when using SSL, libpq might block
waiting for data even though some has already been received.

Broken by careless refactoring in commit 4e86f1b16, so back-patch
to 9.5 where that came in.

Per bug #15802 from David Binderman.

Discussion: https://postgr.es/m/15802-f0911a97f0346526@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ddf927fb13471bec0cc76794eaf552df8a1178fb

Modified Files
--------------
src/interfaces/libpq/fe-misc.c           | 2 +-
src/interfaces/libpq/fe-secure-openssl.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



view thread (5+ messages)

Message-ID: <E1hQCKb-0007ie-O9@gemulon.postgresql.org>
Permalink:  ../E1hQCKb-0007ie-O9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hQCKb-0007ie-O9@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: Fix misuse of an integer as a bool.
  In-Reply-To: <E1hQCKb-0007ie-O9@gemulon.postgresql.org>
  References: <E1hQCKb-0007ie-O9@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