]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/sonic.c
Merge commit '17776638c392d104975aba169e17b186490e1d5e'
[ffmpeg] / libavcodec / sonic.c
index 4ec7d89fde34df346bc048d8895d9024de421e2c..2e3ca79fdd1c8185a7c15ef56496b57363265f18 100644 (file)
@@ -928,6 +928,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
     s->frame_size = s->channels*s->block_align*s->downsampling;
 //    avctx->frame_size = s->block_align;
 
+    if (s->num_taps * s->channels > s->frame_size) {
+        av_log(avctx, AV_LOG_ERROR,
+               "number of taps times channels (%d * %d) larger than frame size %d\n",
+               s->num_taps, s->channels, s->frame_size);
+        return AVERROR_INVALIDDATA;
+    }
+
     av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
         s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);