History log of /netbsd-src/common/lib/libc/stdlib/random.c (Results 1 – 7 of 7)
Revision Date Author Comments
# 1cb7819f 12-Dec-2021 andvar <andvar@NetBSD.org>

fix various typos in comments.


# 819b6be2 22-Feb-2020 fox <fox@NetBSD.org>

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

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@

show more ...


# 7fd2abea 08-Feb-2016 dholland <dholland@NetBSD.org>

whitespace


# f16aa474 12-Jun-2014 christos <christos@NetBSD.org>

update for the new function signatures of initstate/srandom


# 70b3b52a 21-Dec-2005 christos <christos@NetBSD.org>

Add the old small random from the libkern and use it for now.


# 93412868 21-Dec-2005 christos <christos@NetBSD.org>

Make this compile for the kernel again.


# 37c9f0a6 20-Dec-2005 christos <christos@NetBSD.org>

Merge libkern + libc common files. As requested by core.