Files
firmware/src/modules
Thomas Göttgens bdf92e1183 AudioModule: validate codec2 header and bound the RX decode reads (#11036)
* AudioModule: validate codec2 header and bound the RX decode reads

Two issues reachable from a crafted AUDIO_APP payload:

The RX path built a temp codec2 from rx_encode_frame[3] whenever the frame header
did not match ours. codec2_create returns NULL for an invalid mode byte, and the
next call dereferenced it. Only decode frames that carry our own header (magic +
mode) and drop the rest, so the untrusted mode byte never reaches codec2_create.

The decode loop advanced by the frame size while testing only i < rx_encode_frame_index,
so a payload length that was not a multiple of the frame size read past the received
data and could read past rx_encode_frame. Bound each read to i + frameSize <= the
received length clamped to the buffer, and clamp the receive memcpy to the buffer.

Behavior change: audio frames whose codec2 mode differs from this node's configured
mode are dropped instead of decoded with a temporary codec.

* AudioModule: pass byte count (not sample count) to i2s_write

* AudioModule: fix the mirror sample/byte bug on the i2s_read capture path
2026-07-16 19:18:31 -05:00
..
2026-07-16 18:35:33 -05:00
2026-07-01 19:01:27 -05:00
2026-03-06 05:34:41 -06:00
2026-07-01 19:01:27 -05:00
2026-07-01 19:01:27 -05:00
2022-02-27 02:21:02 -08:00
2026-07-16 18:35:33 -05:00
2022-02-27 01:49:24 -08:00
2026-07-01 19:01:27 -05:00
2026-07-01 19:01:27 -05:00
2026-02-19 07:16:33 -06:00
2026-06-30 12:44:25 -05:00
2026-07-01 19:01:27 -05:00
2026-06-30 12:44:25 -05:00
2026-02-19 07:16:33 -06:00