]> git.sesse.net Git - ffmpeg/commitdiff
opusdec: make sure all substreams have the same number of coded samples
authorAnton Khirnov <anton@khirnov.net>
Mon, 24 Nov 2014 10:16:46 +0000 (11:16 +0100)
committerAnton Khirnov <anton@khirnov.net>
Thu, 27 Nov 2014 13:06:03 +0000 (14:06 +0100)
Fixes invalid writes with invalid multichannel streams.

CC:libav-stable@libav.org

libavcodec/opusdec.c

index bf3a54b16bec296e3b16dcb1a556a34a956abaf0..771922e973a475b52dfa5981959b4219a73a5f65 100644 (file)
@@ -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);
         }