Fixes: Assertion failure (invalid stream index) Fixes: 25120/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6565251898933248
Unified · Split
| @@ -530,20 +530,17 @@ static int ea_read_header(AVFormatContext *s) · 529 unmodified lines | |||
| 530 | if (ea->num_channels <= 0 || ea->num_channels > 2) { | 530 | if (ea->num_channels <= 0 || ea->num_channels > 2) { |
| 531 | av_log(s, AV_LOG_WARNING, | 531 | av_log(s, AV_LOG_WARNING, |
| 532 | "Unsupported number of channels: %d\n", ea->num_channels); | 532 | "Unsupported number of channels: %d\n", ea->num_channels); |
| 533 | ea->audio_codec = 0; | 533 | goto no_audio; |
| 534 | return 1; | ||
| 535 | } | 534 | } |
| 536 | if (ea->sample_rate <= 0) { | 535 | if (ea->sample_rate <= 0) { |
| 537 | av_log(s, AV_LOG_ERROR, | 536 | av_log(s, AV_LOG_ERROR, |
| 538 | "Unsupported sample rate: %d\n", ea->sample_rate); | 537 | "Unsupported sample rate: %d\n", ea->sample_rate); |
| 539 | ea->audio_codec = 0; | 538 | goto no_audio; |
| 540 | return 1; | ||
| 541 | } | 539 | } |
| 542 | if (ea->bytes <= 0 || ea->bytes > 2) { | 540 | if (ea->bytes <= 0 || ea->bytes > 2) { |
| 543 | av_log(s, AV_LOG_ERROR, | 541 | av_log(s, AV_LOG_ERROR, |
| 544 | "Invalid number of bytes per sample: %d\n", ea->bytes); | 542 | "Invalid number of bytes per sample: %d\n", ea->bytes); |
| 545 | ea->audio_codec = AV_CODEC_ID_NONE; | 543 | goto no_audio; |
| 546 | return 1; | ||
| 547 | } | 544 | } |
| 548 | 545 | ||
| 549 | /* initialize the audio decoder stream */ | 546 | /* initialize the audio decoder stream */ |
| @@ -564,8 +561,13 @@ static int ea_read_header(AVFormatContext *s) · 14 unmodified lines | |||
| 564 | st->codecpar->bits_per_coded_sample; | 561 | st->codecpar->bits_per_coded_sample; |
| 565 | ea->audio_stream_index = st->index; | 562 | ea->audio_stream_index = st->index; |
| 566 | st->start_time = 0; | 563 | st->start_time = 0; |
| 564 | return 1; | ||
| 567 | } | 565 | } |
| 566 | no_audio: | ||
| 567 | ea->audio_codec = AV_CODEC_ID_NONE; | ||
| 568 | 568 | ||
| 569 | if (!ea->video.codec) | ||
| 570 | return AVERROR_INVALIDDATA; | ||
| 569 | return 1; | 571 | return 1; |
| 570 | } | 572 | } |
| 571 | 573 | ||