CVE-2019-16881: Use after free in portaudio-rs
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.62937%
CWE
Published
8/25/2021
Updated
6/13/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
portaudio-rs | rust | < 0.3.2 | 0.3.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper panic safety in C callback handlers. Both functions:
- Used mem::transmute to convert raw pointers to Boxes
- Called user-provided Rust closures (which might panic)
- Relied on mem::forget AFTER the closure execution to prevent deallocation
If the closure panicked before mem::forget, the Box would be dropped normally, freeing memory while PortAudio might retain the callback pointer. The commit diff shows the fix replaced this pattern with Box::leak/Box::from_raw, eliminating the panic-sensitive mem::forget sequence.