diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-01 18:07:48 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-01 18:07:59 -0400 |
commit | cd7030ff085f5c378e837b392cb719cf23df9d0b (patch) | |
tree | 7e0d90e97dc36706fe016275a302a4075e0b4768 /src/backend/utils/adt/xml.c | |
parent | 6cfb6d987419ce1e7bec0cf3ad22830ed3c2dc08 (diff) | |
download | postgresql-cd7030ff085f5c378e837b392cb719cf23df9d0b.tar.gz postgresql-cd7030ff085f5c378e837b392cb719cf23df9d0b.zip |
Make sampler_random_fract() actually obey its API contract.
This function is documented to return a value in the range (0,1),
which is what its predecessor anl_random_fract() did. However, the
new version depends on pg_erand48() which returns a value in [0,1).
The possibility of returning zero creates hazards of division by zero
or trying to compute log(0) at some call sites, and it might well
break third-party modules using anl_random_fract() too. So let's
change it to never return zero. Spotted by Coverity.
Michael Paquier, cosmetically adjusted by me
Diffstat (limited to 'src/backend/utils/adt/xml.c')
0 files changed, 0 insertions, 0 deletions