Fix inappropriate uses of PG_GETARG_UINT32()
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-12-01T18:26:45Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-inappropriate-uses-of-PG_GETARG_UINT32.patch (text/plain) patch 0001
I noticed that the chr() function uses PG_GETARG_UINT32() to get its argument, even though the argument is a (signed) int. So you get some slightly silly behavior like this: => select chr(-333); ERROR: 54000: requested character too large for encoding: -333 The attached patch fixes this by accepting the argument using PG_GETARG_INT32(), doing some checks, and then casting it to unsigned for the rest of the code. The patch also fixes another inappropriate use in an example in the documentation. These two were the only inappropriate uses I found, after we had fixed a few recently.
Commits
-
Fix inappropriate uses of PG_GETARG_UINT32()
- e9e63b7022dd 15.0 landed