[FFmpeg-devel,1/2] avcodec/utils: report insane channel count errors

Submitted by Marton Balint on July 3, 2018, 10:51 a.m.

Details

Message ID 20180703105112.14814-1-cus@passwd.hu
State Accepted
Commit 5982078e8d56b84de4d538ab4d39f474b833cdc2
Headers show

Commit Message

Marton Balint July 3, 2018, 10:51 a.m.
More than 64 is not *that* insane, so let's report the error at least.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavcodec/utils.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Niedermayer July 4, 2018, 10:06 a.m.
On Tue, Jul 03, 2018 at 12:51:11PM +0200, Marton Balint wrote:
> More than 64 is not *that* insane, so let's report the error at least.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavcodec/utils.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 59d41ccbb6..4ac73fcd92 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -674,6 +674,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
>          av_freep(&avctx->subtitle_header);
>  
>      if (avctx->channels > FF_SANE_NB_CHANNELS) {
> +        av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->channels);
>          ret = AVERROR(EINVAL);
>          goto free_and_end;
>      }

LGTM, if nothing equivalent is otherwise printed

thx

[...]
Marton Balint July 13, 2018, 8:55 p.m.
On Wed, 4 Jul 2018, Michael Niedermayer wrote:

> On Tue, Jul 03, 2018 at 12:51:11PM +0200, Marton Balint wrote:
>> More than 64 is not *that* insane, so let's report the error at least.
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavcodec/utils.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>> index 59d41ccbb6..4ac73fcd92 100644
>> --- a/libavcodec/utils.c
>> +++ b/libavcodec/utils.c
>> @@ -674,6 +674,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
>>          av_freep(&avctx->subtitle_header);
>>
>>      if (avctx->channels > FF_SANE_NB_CHANNELS) {
>> +        av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->channels);
>>          ret = AVERROR(EINVAL);
>>          goto free_and_end;
>>      }
>
> LGTM, if nothing equivalent is otherwise printed

No equivivalent is printed in the general case, there are some demuxers 
which reject this many channels in read_header, but not all of them.

Applied.

Thanks,
Marton

Patch hide | download patch | download mbox

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 59d41ccbb6..4ac73fcd92 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -674,6 +674,7 @@  int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
         av_freep(&avctx->subtitle_header);
 
     if (avctx->channels > FF_SANE_NB_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->channels);
         ret = AVERROR(EINVAL);
         goto free_and_end;
     }