aboutsummaryrefslogtreecommitdiff
path: root/src/voice/streamer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/voice/streamer.rs')
-rw-r--r--src/voice/streamer.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/voice/streamer.rs b/src/voice/streamer.rs
index 5f05879..cf62d27 100644
--- a/src/voice/streamer.rs
+++ b/src/voice/streamer.rs
@@ -48,6 +48,11 @@ impl<R: Read + Send> AudioSource for InputSource<R> {
fn read_opus_frame(&mut self) -> Option<Vec<u8>> {
match self.reader.read_i16::<LittleEndian>() {
Ok(size) => {
+ if size <= 0 {
+ warn!("Invalid opus frame size: {}", size);
+ return None;
+ }
+
let mut frame = Vec::with_capacity(size as usize);
{