postgresql/src/backend
Tom Lane 219d476d8a Fix cidin() to handle values above 2^31 platform-independently.
CommandId is declared as uint32, and values up to 4G are indeed legal.
cidout() handles them properly by treating the value as unsigned int.
But cidin() was just using atoi(), which has platform-dependent behavior
for values outside the range of signed int, as reported by Bart Lengkeek
in bug #14379.  Use strtoul() instead, as xidin() does.

In passing, make some purely cosmetic changes to make xidin/xidout
look more like cidin/cidout; the former didn't have a monopoly on
best practice IMO.

Neither xidin nor cidin make any attempt to throw error for invalid input.
I didn't change that here, and am not sure it's worth worrying about
since neither is really a user-facing type.  The point is just to ensure
that indubitably-valid inputs work as expected.

It's been like this for a long time, so back-patch to all supported
branches.

Report: <20161018152550.1413.6439@wrigleys.postgresql.org>
2016-10-18 12:24:58 -04:00
..
access Fix outdated comments, GIST search queue is not an RBTree anymore. 2016-09-20 11:40:20 +03:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Fix another bug in merging of inherited CHECK constraints. 2016-10-13 17:05:15 -04:00
commands Fix two bugs in merging of inherited CHECK constraints. 2016-10-08 19:29:27 -04:00
executor Be sure to rewind the tuplestore read pointer in non-leader CTEScan nodes. 2016-09-22 11:34:44 -04:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Avoid use of float arithmetic in bipartite_match.c. 2015-08-23 13:02:19 -04:00
libpq Include <sys/select.h> where needed 2016-09-27 01:05:21 -03:00
main Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds 2016-03-10 14:10:32 +01:00
nodes Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:37:50 -04:00
optimizer Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:37:50 -04:00
parser Improve documentation about CREATE TABLE ... LIKE. 2016-07-28 13:26:59 -04:00
po Translation updates 2016-08-08 11:02:52 -04:00
port Try to find out the actual hugepage size when making a MAP_HUGETLB request. 2016-10-13 15:07:04 -04:00
postmaster Fix handling of pgstat counters for TRUNCATE in a prepared transaction. 2016-10-13 19:45:58 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:11:52 -05:00
replication libpqwalreceiver needs to link with libintl when using --enable-nls. 2016-10-07 21:12:25 -04:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:44 -05:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Don't trust CreateFileMapping() to clear the error code on success. 2016-09-23 10:09:52 -04:00
tcop Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
tsearch Fix misestimation of n_distinct for a nearly-unique column with many nulls. 2016-08-07 18:52:02 -04:00
utils Fix cidin() to handle values above 2^31 platform-independently. 2016-10-18 12:24:58 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00