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); }