]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wma.c
wma: check byte_offset_bits
[ffmpeg] / libavcodec / wma.c
index 5af20739a53f59f47d93cbc8bfb4bf125399fbbd..1e6ca61047825b12808253ae8c23cd7908e8d4f7 100644 (file)
@@ -134,6 +134,10 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
 
     bps = (float)avctx->bit_rate / (float)(avctx->channels * avctx->sample_rate);
     s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2;
+    if (s->byte_offset_bits + 3 > MIN_CACHE_BITS) {
+        av_log(avctx, AV_LOG_ERROR, "byte_offset_bits %d is too large\n", s->byte_offset_bits);
+        return AVERROR_PATCHWELCOME;
+    }
 
     /* compute high frequency value and choose if noise coding should
        be activated */