sonora's SIMD layer is 136 lines of unsafe in a young crate #255

Open
opened 2026-10-02 19:03:41 -04:00 by Salastil · 0 comments
Owner

From a memory-safety audit of nobilis on 2 October 2026: its own code has two unsafe blocks (both sound libc calls in main.rs), so what follows is about the code it depends on. Advisories were checked against the OSV/RustSec database for every crate in Cargo.lock, and each one traced to whether it is actually compiled in.

Echo cancellation and noise suppression (#232) are sonora, a Rust port of WebRTC's audio processing. Its sonora-simd 0.2.0 has 136 lines of unsafe (SIMD intrinsics) and sonora-aec3 25 more - the most unsafe of any crate that handles data from other people: the far-end signal it cancels against is the decoded audio of everyone else in the call.

The input is fixed-size float frames, so the exposure is out-of-bounds or misaligned access in its own arithmetic rather than parsing - but the crate is at 0.2 and has had little outside scrutiny. Options: review or fuzz the SIMD paths against the scalar ones with odd lengths and NaNs; check whether it offers a scalar-only build and measure what that costs; pin and watch it.

From a memory-safety audit of nobilis on 2 October 2026: its own code has two `unsafe` blocks (both sound libc calls in `main.rs`), so what follows is about the code it depends on. Advisories were checked against the OSV/RustSec database for every crate in `Cargo.lock`, and each one traced to whether it is actually compiled in. Echo cancellation and noise suppression (#232) are `sonora`, a Rust port of WebRTC's audio processing. Its `sonora-simd` 0.2.0 has **136 lines of `unsafe`** (SIMD intrinsics) and `sonora-aec3` 25 more - the most `unsafe` of any crate that handles data from other people: the far-end signal it cancels against is the decoded audio of everyone else in the call. The input is fixed-size float frames, so the exposure is out-of-bounds or misaligned access in its own arithmetic rather than parsing - but the crate is at 0.2 and has had little outside scrutiny. Options: review or fuzz the SIMD paths against the scalar ones with odd lengths and NaNs; check whether it offers a scalar-only build and measure what that costs; pin and watch it.
Salastil added this to the v1.0 milestone 2026-10-02 19:03:41 -04:00
Salastil added the buglow priorityCVE labels 2026-10-02 19:03:41 -04:00
Salastil removed this from the v1.0 milestone 2026-10-03 21:28:30 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Salastil/moho#255