Message ID | 1341081050-49537-1-git-send-email-martin@martin.st |
---|---|
State | Committed |
Commit | 710bd8a33e9c183ded4a61d742d404d8d5d838ea |
Headers | show |
On Sat, Jun 30, 2012 at 09:30:50PM +0300, Martin Storsjö wrote: > ff_wma_init is used only by wmadec and wmaenc, and neither of them > can handle more than 2 channels. > > This fixes crashes with invalid files. > > Based on patch by Piotr Bandurski and Michael Niedermayer. > --- > libavcodec/wma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/wma.c b/libavcodec/wma.c > index 007653f..b61228b 100644 > --- a/libavcodec/wma.c > +++ b/libavcodec/wma.c > @@ -78,7 +78,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) > int coef_vlc_table; > > if ( avctx->sample_rate <= 0 || avctx->sample_rate > 50000 > - || avctx->channels <= 0 || avctx->channels > 8 > + || avctx->channels <= 0 || avctx->channels > 2 > || avctx->bit_rate <= 0) > return -1; > > -- LGTM (> 2ch is WMA 'Pro' and Lossless anyway)
On 06/30/2012 08:37 PM, Kostya Shishkov wrote: > On Sat, Jun 30, 2012 at 09:30:50PM +0300, Martin Storsjö wrote: >> ff_wma_init is used only by wmadec and wmaenc, and neither of them >> can handle more than 2 channels. >> >> This fixes crashes with invalid files. >> >> Based on patch by Piotr Bandurski and Michael Niedermayer. >> --- >> libavcodec/wma.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavcodec/wma.c b/libavcodec/wma.c >> index 007653f..b61228b 100644 >> --- a/libavcodec/wma.c >> +++ b/libavcodec/wma.c >> @@ -78,7 +78,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) >> int coef_vlc_table; >> >> if ( avctx->sample_rate <= 0 || avctx->sample_rate > 50000 >> - || avctx->channels <= 0 || avctx->channels > 8 >> + || avctx->channels <= 0 || avctx->channels > 2 >> || avctx->bit_rate <= 0) >> return -1; >> >> -- > > LGTM (> 2ch is WMA 'Pro' and Lossless anyway) Can we encode those? lu
On Sat, 30 Jun 2012, Luca Barbato wrote: > On 06/30/2012 08:37 PM, Kostya Shishkov wrote: >> On Sat, Jun 30, 2012 at 09:30:50PM +0300, Martin Storsjö wrote: >>> ff_wma_init is used only by wmadec and wmaenc, and neither of them >>> can handle more than 2 channels. >>> >>> This fixes crashes with invalid files. >>> >>> Based on patch by Piotr Bandurski and Michael Niedermayer. >>> --- >>> libavcodec/wma.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/libavcodec/wma.c b/libavcodec/wma.c >>> index 007653f..b61228b 100644 >>> --- a/libavcodec/wma.c >>> +++ b/libavcodec/wma.c >>> @@ -78,7 +78,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) >>> int coef_vlc_table; >>> >>> if ( avctx->sample_rate <= 0 || avctx->sample_rate > 50000 >>> - || avctx->channels <= 0 || avctx->channels > 8 >>> + || avctx->channels <= 0 || avctx->channels > 2 >>> || avctx->bit_rate <= 0) >>> return -1; >>> >>> -- >> >> LGTM (> 2ch is WMA 'Pro' and Lossless anyway) > > Can we encode those? AFAIK no, and this init code is shared by 'wmadec' and 'wmaenc' (which both are limited to 2 channels), wmapro/ll are separate units and don't use this shared init code. // Martin
diff --git a/libavcodec/wma.c b/libavcodec/wma.c index 007653f..b61228b 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -78,7 +78,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) int coef_vlc_table; if ( avctx->sample_rate <= 0 || avctx->sample_rate > 50000 - || avctx->channels <= 0 || avctx->channels > 8 + || avctx->channels <= 0 || avctx->channels > 2 || avctx->bit_rate <= 0) return -1;