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
Previously, creating a temporary file from a TLS destructor could panic
in fastrand (because the thread-local RNG may have been deallocated).
Now, we fork the RNG before we create each file, falling back on an RNG
with a static seed if the thread-local RNG has been deallocated.
Two downsides to this patch:
1. Temporary files created during TLS deallocation will have extremely
predictable names until the `getrandom` re-seed kicks in (assuming that
feature is enabled). IMO, that's fine; this would panic previously.
2. `getrandom` re-seeding used to re-randomize to the entire per-thread
RNG, now it only applies to the per-filename RNG. However, the will
still serve its purpose as a mitigation against potential DoS attacks.
I also considered managing the thread-local RNG myself instead of
relying on fastrand, but that just isn't worth the added code, IMO.
Thanks to @stoeckmann for reporting this and explaining the issue to me.
I went with this version instead of their version because I needed to
keep `tmpname` as a separate function for some tempfile v4 changes.
fixes#281
0 commit comments