forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd7c19d6
committed
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, thenew version depends on pg_erand48() which returns a value in [0,1).The possibility of returning zero creates hazards of division by zeroor trying to compute log(0) at some call sites, and it might wellbreak third-party modules using anl_random_fract() too. So let'schange it to never return zero. Spotted by Coverity.Michael Paquier, cosmetically adjusted by me1 parent8217370 commitd7c19d6
1 file changed
+8
-1
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
237 | 237 |
| |
238 | 238 |
| |
239 | 239 |
| |
240 |
| - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
241 | 248 |
| |
242 | 249 |
| |
243 | 250 |
| |
|
0 commit comments
Comments
(0)