aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rng
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2020-02-19 09:24:48 -0500
committerJack Lloyd <[email protected]>2020-02-19 09:24:48 -0500
commit83836813a47c953562af0a47e7fbb61b89209187 (patch)
treeb60945f46c992c60cc0823dc0d204481ba636007 /src/lib/rng
parenteb22b81e1b3cdfc8870d876c252e15b9e17c1f42 (diff)
Fix a crash in System_RNG on macOS 10.15
See #2268
Diffstat (limited to 'src/lib/rng')
-rw-r--r--src/lib/rng/system_rng/system_rng.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp
index af508fd90..3f884115a 100644
--- a/src/lib/rng/system_rng/system_rng.cpp
+++ b/src/lib/rng/system_rng/system_rng.cpp
@@ -119,7 +119,11 @@ class System_RNG_Impl final : public RandomNumberGenerator
void randomize(uint8_t buf[], size_t len) override
{
- ::arc4random_buf(buf, len);
+ // macOS 10.15 arc4random crashes if called with len == 0
+ if(len > 0)
+ {
+ ::arc4random_buf(buf, len);
+ }
}
bool accepts_input() const override { return false; }