History

avformat/mov_chan: add extra checks to channel description count

Make sure it's not zero, and equal or bigger than number of channels Fixes: Timeout / DOS Fixes: 67143/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-4858720481771520

James Almer committed 2 years ago

Commit 1c706ce1 parent fec6a8d1 file · +14 −2Browse files

Unified · Split

libavformat/mov_chan.c+14−2
@@ -543,10 +543,22 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, · 542 unmodified lines
543 return 0;543 return 0;
544 544
545 if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) {545 if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) {
546 int nb_channels = ch_layout->nb_channels ? ch_layout->nb_channels : num_descr;546 int nb_channels = ch_layout->nb_channels;
547
548 if (!num_descr || num_descr < nb_channels) {
549 av_log(s, AV_LOG_ERROR, "got %d channel descriptions when at least %d were needed\n",
550 num_descr, nb_channels);
551 return AVERROR_INVALIDDATA;
552 }
553
547 if (num_descr > nb_channels) {554 if (num_descr > nb_channels) {
548 av_log(s, AV_LOG_WARNING, "got %d channel descriptions, capping to the number of channels %d\n",555 int strict = s->strict_std_compliance >= FF_COMPLIANCE_STRICT;
556 av_log(s, strict ? AV_LOG_ERROR : AV_LOG_WARNING,
557 "got %d channel descriptions when number of channels is %d\n",
549 num_descr, nb_channels);558 num_descr, nb_channels);
559 if (strict)
560 return AVERROR_INVALIDDATA;
561 av_log(s, AV_LOG_WARNING, "capping channel descriptions to the number of channels\n");
550 num_descr = nb_channels;562 num_descr = nb_channels;
551 }563 }
552 564

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t