From aac23534e7aeba128bb515a9f680273eb0b8360d Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 27 Oct 2020 00:31:29 -0400 Subject: [PATCH] These tests didn't do what you thought they did The `rng` assignment inside the closure was actually reassigning the local `rng`, which would then occaisionally segfault, because `RandomDevice` is immutable, so there's nothing that actually rooted it to the device object. Side note: Somebody should probably add assertions that the various things we're trying to protect by rooting them in the context object are actually mutable. However, I've spent too much time on this already so I'll leave that to somebody else ;). --- test/runtests.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index fc9bf85..464659c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -92,8 +92,7 @@ let entropy = MbedTLS.Entropy() function entropy_func(buf) - rng = RandomDevice() - buf[:] = rand(rng, UInt8, length(buf)) + buf[:] = rand(RandomDevice(), UInt8, length(buf)) return Cint(length(buf)) end @@ -134,8 +133,7 @@ let entropy = MbedTLS.Entropy() function entropy_func(buf) - rng = RandomDevice() - buf[:] = rand(rng, UInt8, length(buf)) + buf[:] = rand(RandomDevice(), UInt8, length(buf)) return Cint(length(buf)) end