parent
74e77756ef
commit
92bee36b3e
|
|
@ -3232,6 +3232,18 @@ INTERCEPTOR(int, lrand48_r, void *buffer, long *result) {
|
|||
#define INIT_DRAND48_R
|
||||
#endif
|
||||
|
||||
#if SANITIZER_INTERCEPT_RAND_R
|
||||
INTERCEPTOR(int, rand_r, unsigned *seedp) {
|
||||
void *ctx;
|
||||
COMMON_INTERCEPTOR_ENTER(ctx, rand_r, seedp);
|
||||
COMMON_INTERCEPTOR_READ_RANGE(ctx, seedp, sizeof(*seedp));
|
||||
return REAL(rand_r)(seedp);
|
||||
}
|
||||
#define INIT_RAND_R COMMON_INTERCEPT_FUNCTION(rand_r);
|
||||
#else
|
||||
#define INIT_RAND_R
|
||||
#endif
|
||||
|
||||
#if SANITIZER_INTERCEPT_GETLINE
|
||||
INTERCEPTOR(SSIZE_T, getline, char **lineptr, SIZE_T *n, void *stream) {
|
||||
void *ctx;
|
||||
|
|
@ -3704,6 +3716,7 @@ INTERCEPTOR(int, ftime, __sanitizer_timeb *tp) {
|
|||
INIT_LGAMMA; \
|
||||
INIT_LGAMMA_R; \
|
||||
INIT_DRAND48_R; \
|
||||
INIT_RAND_R; \
|
||||
INIT_GETLINE; \
|
||||
INIT_ICONV; \
|
||||
INIT_TIMES; \
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@
|
|||
#define SANITIZER_INTERCEPT_LGAMMA SI_NOT_WINDOWS
|
||||
#define SANITIZER_INTERCEPT_LGAMMA_R SI_LINUX
|
||||
#define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID
|
||||
#define SANITIZER_INTERCEPT_RAND_R SI_MAC || SI_LINUX_NOT_ANDROID
|
||||
#define SANITIZER_INTERCEPT_ICONV SI_LINUX_NOT_ANDROID
|
||||
#define SANITIZER_INTERCEPT_TIMES SI_NOT_WINDOWS
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %t
|
||||
// RUN: %clangxx_msan -m64 -O0 -g -DUNINIT %s -o %t && not %t 2>&1 | FileCheck %s
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
unsigned seed;
|
||||
#ifndef UNINIT
|
||||
seed = 42;
|
||||
#endif
|
||||
int v = rand_r(&seed);
|
||||
// CHECK: MemorySanitizer: use-of-uninitialized-value
|
||||
// CHECK: in main{{.*}}rand_r.cc:[[@LINE-2]]
|
||||
if (v) printf(".\n");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue