From af0d6c0695e3c459989b911b6fb62ce40058440e Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sun, 7 Dec 2014 18:23:55 -0500 Subject: [PATCH] Fixed possible issue with wrong size being passed to opus_decode(). --- toxav/codec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/toxav/codec.c b/toxav/codec.c index eb770f39..baaad47a 100644 --- a/toxav/codec.c +++ b/toxav/codec.c @@ -379,9 +379,8 @@ void cs_do(CSSession *cs) pthread_mutex_unlock(cs->queue_mutex); - uint16_t fsize = (cs->audio_decoder_channels * - (cs->audio_decoder_sample_rate * cs->audio_decoder_frame_duration) / 1000); - int16_t tmp[fsize]; + uint16_t fsize = ((cs->audio_decoder_sample_rate * cs->audio_decoder_frame_duration) / 1000); + int16_t tmp[fsize * cs->audio_decoder_channels]; rc = opus_decode(cs->audio_decoder, p->data, p->size, tmp, fsize, (p->size == 0)); free(p);