serenity-rs / songbird

An async Rust library for the Discord voice API
ISC License
386 stars 108 forks source link

Driver: Prevent panic when decrypting undersized RTP packets #122

Closed FelixMcFelix closed 2 years ago

FelixMcFelix commented 2 years ago

Decrypt logic had two locations where the nonce would be separated from the payload without verifying the buffer size first, causing a panic for small packets.

Nonce and header removal now return an error if there are insufficient bytes.

Tested using cargo make ready, with some new tests to check that small packets simply return an Err(...), and that encryption/decryption still function.