diff options
author | Jack Lloyd <[email protected]> | 2020-02-19 09:24:48 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-02-19 09:24:48 -0500 |
commit | 83836813a47c953562af0a47e7fbb61b89209187 (patch) | |
tree | b60945f46c992c60cc0823dc0d204481ba636007 | |
parent | eb22b81e1b3cdfc8870d876c252e15b9e17c1f42 (diff) |
Fix a crash in System_RNG on macOS 10.15
See #2268
-rw-r--r-- | src/lib/rng/system_rng/system_rng.cpp | 6 |
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; } |