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())
The following reply was made to PR lib/56824; it has been noted by GNATS.
From: Joerg Sonnenberger <joerg%bec.de@localhost>
To: Guilherme Janczak <guilherme.janczak%yandex.com@localhost>
Cc: gnats-bugs%netbsd.org@localhost, lib-bug-people%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, joerg%netbsd.org@localhost
Subject: Re: lib/56824 (modulo by 0 in arc4random_uniform())
Date: Mon, 9 May 2022 01:05:12 +0200
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