NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Rust (crates.io)

CVE-2022-39394: wasmtime_trap_code C API function has out of bounds write vulnerability

lowCVSS 3.1 3.8GHSA-h84q-m8rr-3v9q

Impact There is a bug in Wasmtime's C API implementation where the definition of the wasmtimetrapcode does not match its declared signature in the wasmtime/trap.h header file. This discrepancy causes the function implementation to perform a 4-byte write into a 1-byte buffer provided by the caller. This can lead to three zero bytes being written beyond the 1-byte location provided by the caller.

Published Feb 1, 2024 · Updated May 2, 2025

Affected packages

wasmtime

Ecosystem
Rust (crates.io)
Affected
>= 2.0.0, < 2.0.2
Fixed in
2.0.2
Check
cargo tree -i wasmtime

wasmtime

Ecosystem
Rust (crates.io)
Affected
< 1.0.2
Fixed in
1.0.2
Check
cargo tree -i wasmtime

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

Impact

There is a bug in Wasmtime's C API implementation where the definition of the wasmtime_trap_code does not match its declared signature in the wasmtime/trap.h header file. This discrepancy causes the function implementation to perform a 4-byte write into a 1-byte buffer provided by the caller. This can lead to three zero bytes being written beyond the 1-byte location provided by the caller.

Patches

This bug has been patched and users should upgrade to Wasmtime 2.0.2.

Workarounds

This can be worked around by providing a 4-byte buffer casted to a 1-byte buffer when calling wasmtime_trap_code. Users of the wasmtime crate are not affected by this issue, only users of the C API function wasmtime_trap_code are affected.

References

For more information

If you have any questions or comments about this advisory:

Credited to kpreisser.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More Rust (crates.io) vulnerabilities

All Rust (crates.io) entries