| Summary: | /usr/games/random returns every line | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Vick Khera <vivek> | ||||
| Component: | amd64 | Assignee: | freebsd-amd64 (Nobody) <amd64> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 5.3-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Vick Khera
2005-05-19 19:50:01 UTC
Problem is lines like
selected = (int)(denom * random() / LONG_MAX) == 0;
which cause the overflow. Replacing LONG_MAX with INT_MAX here fixes the bug.
(The same replacement should probably be done in the other two places that
LONG_MAX occurs, since the -e flag is similarly broken.)
--
These are your friends - Adem
GPG: FEA2 A3FE Adriaan de Groot
Here's a patch for /usr/src/games/random/random.c which seems to solve the problem, based on Adriaan's message. State Changed From-To: open->patched Fix committed to HEAD. Will MFC after a week. State Changed From-To: patched->closed Fix committed to RELENG_5. |