summaryrefslogtreecommitdiff
path: root/ext/standard/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/random.c')
-rw-r--r--ext/standard/random.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/standard/random.c b/ext/standard/random.c
index 01d99a5eef..9fe2ac2133 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -38,6 +38,10 @@
# endif
#endif
+#if __has_feature(memory_sanitizer)
+# include <sanitizer/msan_interface.h>
+#endif
+
#ifdef ZTS
int random_globals_id;
#else
@@ -133,6 +137,10 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
}
}
+#if __has_feature(memory_sanitizer)
+ /* MSan does not instrument manual syscall invocations. */
+ __msan_unpoison(bytes + read_bytes, n);
+#endif
read_bytes += (size_t) n;
}
#endif