aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/opusdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-11-24 11:16:46 +0100
committerAnton Khirnov <anton@khirnov.net>2014-11-27 14:11:51 +0100
commitca78ee73db9e059f501706ba6108e23902e84933 (patch)
treebcf8eebc5d86358a7c3713577fd790292b63881b /libavcodec/opusdec.c
parent517ce1d09b5e6b72afc2ef9490b5f8ca42fa6a65 (diff)
downloadffmpeg-ca78ee73db9e059f501706ba6108e23902e84933.tar.gz
opusdec: make sure all substreams have the same number of coded samples
Fixes invalid writes with invalid multichannel streams. CC:libav-stable@libav.org (cherry picked from commit 1973079417e8701b52ba810a72cb6c7c6f7f9a56) Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/opusdec.c')
-rw-r--r--libavcodec/opusdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index bf3a54b16b..771922e973 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -500,6 +500,12 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
return ret;
}
+ if (coded_samples != s->packet.frame_count * s->packet.frame_duration) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Mismatching coded sample count in substream %d.\n", i);
+ return AVERROR_INVALIDDATA;
+ }
+
s->silk_samplerate = get_silk_samplerate(s->packet.config);
}