From 76546fceb53df45308ef81414e63eed54687f8ac Mon Sep 17 00:00:00 2001 From: Edwin Smith Date: Sat, 25 May 2013 12:09:30 -0700 Subject: [PATCH] Don't use RAND_bytes() under valgrind. The results are marked uninitialized and trigger spew. --- hphp/runtime/base/zend/zend_rand.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hphp/runtime/base/zend/zend_rand.cpp b/hphp/runtime/base/zend/zend_rand.cpp index f9c52bc88..17a9c9c1b 100644 --- a/hphp/runtime/base/zend/zend_rand.cpp +++ b/hphp/runtime/base/zend/zend_rand.cpp @@ -254,6 +254,10 @@ double math_combined_lcg() { } int64_t math_generate_seed() { +#ifdef VALGRIND + // valgrind treats memory from RAND_bytes as uninitialized + return GENERATE_SEED(); +#endif int64_t value; if (RAND_bytes((unsigned char *)&value, sizeof(value)) < 1) { return GENERATE_SEED();