pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix inappropriate uses of PG_GETARG_UINT32()
Date: Mon, 06 Dec 2021 12:47:03 +0000
Message-ID: <E1muDOZ-0005QX-Uc@gemulon.postgresql.org> (raw)

Fix inappropriate uses of PG_GETARG_UINT32()

The chr() function used PG_GETARG_UINT32() even though the argument is
declared as (signed) integer.  As a result, you can pass negative
arguments to this function and it internally interprets them as
positive.  Ultimately ends up being harmless, but it seems wrong, so
fix this and rearrange the internal error checking a bit to
accommodate this.

Another case was in the documentation, where example code used
PG_GETARG_UINT32() with an argument declared as signed integer.

Reviewed-by: Nathan Bossart <bossartn@amazon.com>
Discussion: https://www.postgresql.org/message-id/flat/7e43869b-d412-8f81-30a3-809783edc9a3%40enterprisedb.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/xfunc.sgml               |  2 +-
src/backend/utils/adt/oracle_compat.c | 33 ++++++++++++++++++++-------------
2 files changed, 21 insertions(+), 14 deletions(-)



Message-ID: <E1muDOZ-0005QX-Uc@gemulon.postgresql.org>
Permalink:  ../E1muDOZ-0005QX-Uc@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1muDOZ-0005QX-Uc@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: peter@eisentraut.org
  Subject: Re: pgsql: Fix inappropriate uses of PG_GETARG_UINT32()
  In-Reply-To: <E1muDOZ-0005QX-Uc@gemulon.postgresql.org>
  References: <E1muDOZ-0005QX-Uc@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