On 9/13/2024 2:48 PM, Michael Niedermayer wrote:
On Fri, Sep 13, 2024 at 12:08:45PM +0200, Anton Khirnov wrote:Quoting Michael Niedermayer (2024-09-13 01:33:31)We do not support more channels. For example avcodec_open2() limits channels this way tooThe example file contains multiple chunks with over 16 million channelsWe had this discussion already.I remembered something too, but couldnt find the thread within teh time i was looking for itAd-hoc checks like this are only addressing a symptom (probably one of many), and hide the actual bug.If you have a better fix, submit it.
Does the following help with this sample?
diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index cc5b333129..4484a22a10 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -543,10 +543,22 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, return 0; if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) { - int nb_channels = ch_layout->nb_channels ? ch_layout->nb_channels : num_descr; + int nb_channels = ch_layout->nb_channels; + + if (!num_descr || num_descr < nb_channels) { + av_log(s, AV_LOG_ERROR, "got %d channel descriptions when at least %d were needed\n", + num_descr, nb_channels); + return AVERROR_INVALIDDATA; + } + if (num_descr > nb_channels) { - av_log(s, AV_LOG_WARNING, "got %d channel descriptions, capping to the number of channels %d\n", + int strict = s->strict_std_compliance >= FF_COMPLIANCE_STRICT; + av_log(s, strict ? AV_LOG_ERROR : AV_LOG_WARNING, + "got %d channel descriptions when number of channels is %d\n", num_descr, nb_channels); + if (strict) + return AVERROR_INVALIDDATA; + av_log(s, AV_LOG_WARNING, "capping channel descriptions to the number of channels\n"); num_descr = nb_channels; }
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".