[FFmpeg-cvslog] opusdec: make sure all substreams have the same number of coded samples

Anton Khirnov git at videolan.org
Tue Jan 6 19:35:25 CET 2015


ffmpeg | branch: release/2.3 | Anton Khirnov <anton at khirnov.net> | Mon Nov 24 11:16:46 2014 +0100| [5630d5cdc2673a6699c8e0173075be324430576b] | committer: Michael Niedermayer

opusdec: make sure all substreams have the same number of coded samples

Fixes invalid writes with invalid multichannel streams.

CC:libav-stable at libav.org
(cherry picked from commit 1973079417e8701b52ba810a72cb6c7c6f7f9a56)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5630d5cdc2673a6699c8e0173075be324430576b
---

 libavcodec/opusdec.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index b28edfb..3ce519d 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -499,6 +499,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);
         }
 



More information about the ffmpeg-cvslog mailing list