You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will cause the test to fail and show the following output:
1/5 test "Hx == (Hy XOR hash(fp))"...OK
2/5 test "is not completely broken"...OK
3/5 test "generics are not completely broken"...OK
4/5 test "too full when adding too many copies"...�`6,�Rʶ��t5i�p error: TooFull
...
The garbling happens also in 0.4.0.
The text was updated successfully, but these errors were encountered:
Oh, this is quite nasty. The culprit is this line:
varrand=std.rand.DefaultPrng.init(42).random;
Here you have:
std.rand.DefaultPrng.init(42) that is a Xoroshiro128
std.rand.DefaultPrng.init(42).random that is a Random
Now, rand is just the Random part of the Xoroshiro128 structure and that means that whenever you call the fillFn and it tries to access the s field you're actually corrupting random memory.
And it turns out that your code ends up corrupting the error message stored in global_array 🎉
So it turns out it's not much of a bug, it's rather a programming error.
On a side note, why don't we allocate the buffer & slice that are passed on to panic() on the stack? Global state always feels icky to me.
How to reproduce (from zig/master, on macOS):
Edit line 213 of https://github.com/kristoff-it/zig-cuckoofilter/blob/b5447d98282c780b396897ea50ca1ddafab901bb/cuckoofilter.zig from
to
This will cause the test to fail and show the following output:
The garbling happens also in 0.4.0.
The text was updated successfully, but these errors were encountered: