Added a 10MB limit and lower bound to `payload_length` read from network payloads in `wakeword.py` and `wakeword_bench.py` to prevent unbounded memory allocation and infinite waiting for malicious/corrupt frames. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
456 B
456 B
2025-02-14 — Bound wakeword payload length
Learning: payload_length read from network JSON payloads in wakeword.py and wakeword_bench.py lacked bounds checks, allowing a malicious Wyoming server (or MITM) to cause a DoS by providing a huge length and freezing the read loop or consuming all memory.
Action: Added if not (0 <= payload_len <= 10 * 1024 * 1024): bounds check to safely drop oversized or negative payload_length frames.