zstd is vulnerable to Use-After-Free
59
Medium Risk
The with_prepared_dictionary constructors on the streaming and raw Encoder/Decoder register the supplied EncoderDictionary/DecoderDictionary with the underlying zstd context by raw pointer without tying the dictionary borrow to the context lifetime. Safe code can drop the dictionary while the encoder or decoder is still alive, leaving the context with a dangling pointer into freed memory. The next compression or decompression call dereferences that pointer, a use-after-free reachable without any unsafe. The fix constrains the dictionary reference to &'a so the borrow checker keeps the dictionary alive as long as the stream that uses it.
You are affected if you are using a version that falls within the vulnerable range and you build an encoder or decoder with the with_prepared_dictionary constructors.
zstd is vulnerable to Use-After-Free in versions 0.4.20 - 0.13.3.
Upgrade the zstd 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.