postgresql/src
Tom Lane e090466411 Fix latent problem with pg_jrand48().
POSIX specifies that jrand48() returns a signed 32-bit value (in the
range [-2^31, 2^31)), but our code was returning an unsigned 32-bit
value (in the range [0, 2^32)).  This doesn't actually matter to any
existing call site, because they all cast the "long" result to int32
or uint32; but it will doubtless bite somebody in the future.
To fix, cast the arithmetic result to int32 explicitly before the
compiler widens it to long (if widening is needed).

While at it, upgrade this file's far-short-of-project-style comments.
Had there been some peer pressure to document pg_jrand48() properly,
maybe this thinko wouldn't have gotten committed to begin with.

Backpatch to v10 where pg_jrand48() was added, just in case somebody
back-patches a fix that uses it and depends on the standard behavior.

Discussion: https://postgr.es/m/17235.1545951602@sss.pgh.pa.us
2018-12-28 14:09:03 -05:00
..
backend Fix thinko in previous commit 2018-12-28 15:18:00 -03:00
bin pg_dump: Add missing newline to error message 2018-12-27 10:03:28 +01:00
common Fix portability failure introduced in commits d2b0b60e7 et al. 2018-12-26 15:30:10 -05:00
fe_utils Fix translation of special characters in psql's LaTeX output modes. 2018-11-26 17:32:51 -05:00
include Remove obsolete IndexIs* macros 2018-12-27 10:07:46 +01:00
interfaces In PQprint(), write HTML table trailer before closing the output pipe. 2018-12-07 13:11:30 -05:00
makefiles Add PGXS options to control TAP and isolation tests, take two 2018-12-03 09:27:35 +09:00
pl Make type "name" collation-aware. 2018-12-19 17:46:25 -05:00
port Fix latent problem with pg_jrand48(). 2018-12-28 14:09:03 -05:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Reduce length of GIN predicate locking isolation test suite 2018-12-28 03:33:10 +03:00
timezone Sync our copy of the timezone library with IANA release tzcode2018g. 2018-10-31 09:47:53 -04:00
tools Create a separate oid range for oids assigned by genbki.pl. 2018-12-13 14:50:57 -08:00
tutorial Deduplicate "invalid input syntax" messages for various types. 2018-07-22 14:58:01 -07:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Remove useless symbol from Makefile.global. 2018-11-06 10:57:51 -05:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00