NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/56824 (modulo by 0 in arc4random_uniform())



Am Sun, May 08, 2022 at 10:58:46PM +0000 schrieb Guilherme Janczak:
> On Sun, May 08, 2022 at 10:40:10PM +0000, joerg%NetBSD.org@localhost wrote:
> > Synopsis: modulo by 0 in arc4random_uniform()
> >
> > State-Changed-From-To: open->closed
> > State-Changed-By: joerg%NetBSD.org@localhost
> > State-Changed-When: Sun, 08 May 2022 22:40:10 +0000
> > State-Changed-Why:
> > This is not a bug. You are asking for a number in the range [0, 0), which is empty.
> > A domain error is the correct result.
> >
> That's true, but arc4random_uniform comes from OpenBSD and their version
> returns 0 in this case. Wouldn't it make more sense to imitate OpenBSD
> behavior than to introduce different behavior?

It doesn't make the answer less nonsensical.

Joerg


Home | Main Index | Thread Index | Old Index