OpenGrok
Cross Reference: random.c
xref
: /
src
/
common
/
lib
/
libc
/
stdlib
/
random.c
Home
|
History
|
Annotate
|
Download
|
only in
stdlib
History log of
/src/common/lib/libc/stdlib/random.c
Revision
Date
Author
Comments
1.7
12-Dec-2021
andvar
fix various typos in comments.
1.6
22-Feb-2020
fox
common/lib/libc/stdlib: Fix possible signed integer overflow.
common/lib/libc/stdlib/random.c:482:6 can result in signed integer overflow.
This bug was reported by UBSan runs.
The change has been tested using the following program to generate random numbers
in both the old and the new library and can be used to verify the correctness of the
library after the change.
#include <stdio.h>
#include <stdlib.h>
#define COUNT 1000 * 1000
int
main(void)
{
int i;
FILE *fp = fopen("numbers.txt", "w");
srandom(0xdeadbeef);
for(i = 0; i < COUNT; i++) {
fprintf(fp, "%ld\n", random());
}
fclose(fp);
return 0;
}
Reviewed by: riastradh@ , kamil@
1.5
08-Feb-2016
dholland
branches: 1.5.16; 1.5.20;
whitespace
1.4
12-Jun-2014
christos
update for the new function signatures of initstate/srandom
1.3
21-Dec-2005
christos
branches: 1.3.56; 1.3.70;
Add the old small random from the libkern and use it for now.
1.2
21-Dec-2005
christos
Make this compile for the kernel again.
1.1
20-Dec-2005
christos
Merge libkern + libc common files. As requested by core.
1.3.70.1
10-Aug-2014
tls
Rebase.
1.3.56.1
19-Aug-2014
tls
Rebase to HEAD as of a few days ago.
1.5.20.1
29-Feb-2020
ad
Sync with head.
1.5.16.3
21-Apr-2020
martin
Ooops, restore accidently removed files from merge mishap
1.5.16.2
21-Apr-2020
martin
Sync with HEAD
1.5.16.1
08-Apr-2020
martin
Merge changes from current as of 20200406
Indexes created Sat Sep 20 22:09:52 GMT 2025