]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
sanity checks (should prevent hypothetical div by zero issue)
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 30 May 2007 23:06:37 +0000 (23:06 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 30 May 2007 23:06:37 +0000 (23:06 +0000)
should fix sf bug #1547313

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9164 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/wma.c
libavcodec/wmadec.c

index 2241a07a0ec91c3cfaf30d16ce94d3f9a1d460ad..1f1495e6eff22483c019f0c926c6682be8f2fd83 100644 (file)
@@ -72,6 +72,11 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
     int sample_rate1;
     int coef_vlc_table;
 
+    if(   avctx->sample_rate<=0 || avctx->sample_rate>50000
+       || avctx->channels<=0 || avctx->channels>8
+       || avctx->bit_rate<=0)
+        return -1;
+
     s->sample_rate = avctx->sample_rate;
     s->nb_channels = avctx->channels;
     s->bit_rate = avctx->bit_rate;
index 2022f3dba7ce129e69aeb4649522709025588246..da02f698248a95b4e8c1bae5070bc96e44ea0e47 100644 (file)
@@ -106,7 +106,8 @@ static int wma_decode_init(AVCodecContext * avctx)
     s->use_bit_reservoir = flags2 & 0x0002;
     s->use_variable_block_len = flags2 & 0x0004;
 
-    ff_wma_init(avctx, flags2);
+    if(ff_wma_init(avctx, flags2)<0)
+        return -1;
 
     /* init MDCT */
     for(i = 0; i < s->nb_block_sizes; i++)