History

avformat/mov: further ensure mov_build_index isn't run twice

If sc->tts_count is not 0, then the sample index has already been built. Fixes: Null-dereference READ Fixes: 396192874/clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4589309789143040

James Almer committed 1 year ago

Commit 261ec6c1 parent 7e848651 file · +5 −5Browse files

Unified · Split

libavformat/mov.c+5−5
@@ -4688,7 +4688,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) · 4687 unmodified lines
46884688
46894689 /* only use old uncompressed audio chunk demuxing when stts specifies it */
46904690 if (!(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
4691− sc->stts_count == 1 && sc->stts_data[0].duration == 1)) {
4691+ sc->stts_count == 1 && sc->stts_data && sc->stts_data[0].duration == 1)) {
46924692 unsigned int current_sample = 0;
46934693 unsigned int stts_sample = 0;
46944694 unsigned int sample_size;
@@ -4700,7 +4700,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) · 5 unmodified lines
47004700
47014701 current_dts -= sc->dts_shift;
47024702
4703− if (!sc->sample_count || sti->nb_index_entries)
4703+ if (!sc->sample_count || sti->nb_index_entries || sc->tts_count)
47044704 return;
47054705 if (sc->sample_count >= UINT_MAX / sizeof(*sti->index_entries) - sti->nb_index_entries)
47064706 return;
@@ -4811,11 +4811,11 @@ static void mov_build_index(MOVContext *mov, AVStream *st) · 104 unmodified lines
48114811 } else {
48124812 unsigned chunk_samples, total = 0;
48134813
4814− ret = mov_merge_tts_data(mov, st, MOV_MERGE_CTTS);
4815− if (ret < 0)
4814+ if (!sc->chunk_count || sc->tts_count)
48164815 return;
48174816
4818− if (!sc->chunk_count)
4817+ ret = mov_merge_tts_data(mov, st, MOV_MERGE_CTTS);
4818+ if (ret < 0)
48194819 return;
48204820
48214821 // compute total chunk count

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