History

avformat/electronicarts: Check if there are any streams

Fixes: Assertion failure (invalid stream index) Fixes: 25120/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6565251898933248

Michael Niedermayer committed 6 years ago

Commit 39a98621 parent a1286491 file · +8 −6Browse files

Unified · Split

libavformat/electronicarts.c+8−6
@@ -530,20 +530,17 @@ static int ea_read_header(AVFormatContext *s) · 529 unmodified lines
530530 if (ea->num_channels <= 0 || ea->num_channels > 2) {
531531 av_log(s, AV_LOG_WARNING,
532532 "Unsupported number of channels: %d\n", ea->num_channels);
533− ea->audio_codec = 0;
534− return 1;
533+ goto no_audio;
535534 }
536535 if (ea->sample_rate <= 0) {
537536 av_log(s, AV_LOG_ERROR,
538537 "Unsupported sample rate: %d\n", ea->sample_rate);
539− ea->audio_codec = 0;
540− return 1;
538+ goto no_audio;
541539 }
542540 if (ea->bytes <= 0 || ea->bytes > 2) {
543541 av_log(s, AV_LOG_ERROR,
544542 "Invalid number of bytes per sample: %d\n", ea->bytes);
545− ea->audio_codec = AV_CODEC_ID_NONE;
546− return 1;
543+ goto no_audio;
547544 }
548545
549546 /* initialize the audio decoder stream */
@@ -564,8 +561,13 @@ static int ea_read_header(AVFormatContext *s) · 14 unmodified lines
564561 st->codecpar->bits_per_coded_sample;
565562 ea->audio_stream_index = st->index;
566563 st->start_time = 0;
564+ return 1;
567565 }
566+no_audio:
567+ ea->audio_codec = AV_CODEC_ID_NONE;
568568
569+ if (!ea->video.codec)
570+ return AVERROR_INVALIDDATA;
569571 return 1;
570572 }
571573

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