1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

sanity checks (should prevent hypothetical div by zero issue)

should fix sf bug #1547313

Originally committed as revision 9164 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2007-05-30 23:06:37 +00:00
parent 61d49d122c
commit 47b777ceed
2 changed files with 7 additions and 1 deletions

View File

@ -72,6 +72,11 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
int sample_rate1; int sample_rate1;
int coef_vlc_table; 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->sample_rate = avctx->sample_rate;
s->nb_channels = avctx->channels; s->nb_channels = avctx->channels;
s->bit_rate = avctx->bit_rate; s->bit_rate = avctx->bit_rate;

View File

@ -106,7 +106,8 @@ static int wma_decode_init(AVCodecContext * avctx)
s->use_bit_reservoir = flags2 & 0x0002; s->use_bit_reservoir = flags2 & 0x0002;
s->use_variable_block_len = flags2 & 0x0004; s->use_variable_block_len = flags2 & 0x0004;
ff_wma_init(avctx, flags2); if(ff_wma_init(avctx, flags2)<0)
return -1;
/* init MDCT */ /* init MDCT */
for(i = 0; i < s->nb_block_sizes; i++) for(i = 0; i < s->nb_block_sizes; i++)