zstd-safe is vulnerable to Use After Free
35
Low Risk
AdvancedSeekable implements DerefMut, exposing a mutable reference to its inner Seekable context while a raw pointer to the boxed reader stays behind in the same struct. Safe code can call mem::swap on that reference to move the C context into an unrelated Seekable value, and dropping the original AdvancedSeekable then frees the boxed reader while the swapped-in context still holds a pointer into it. A later decompression call on the swapped context dereferences that freed reader through the FFI read/seek callbacks, producing a heap use after free. The fix removes the DerefMut implementation so callers can no longer split the context from its backing reader.
You are affected if you are using a version that falls within the vulnerable range and you use the seekable feature's AdvancedSeekable decompression wrapper.
zstd-safe is vulnerable to Use After Free in versions 7.2.2 - 7.3.0.
Upgrade the zstd-safe library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.