1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-10-06 05:47:18 +02:00

movenc: ensure chapters track extradata is not null and populated

fix a regression introduced in 4eca8df,
writing chapters failed if chapters where
not available before mov_write_header().

(cherry picked from commit b2f5bc7fd3)
This commit is contained in:
Damiano Galassi
2025-08-22 17:01:26 +02:00
committed by James Almer
parent 140fd653ae
commit e219c8f77b

View File

@@ -7463,6 +7463,14 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
return ret;
memcpy(track->par->extradata, stub_header, sizeof(stub_header));
if (track->extradata == NULL) {
track->stsd_count = 1;
track->extradata = av_calloc(1, sizeof(*track->extradata));
track->extradata_size = av_calloc(1, sizeof(*track->extradata_size));
if (!track->extradata || !track->extradata_size)
return AVERROR(ENOMEM);
}
track->extradata[0] = av_memdup(stub_header, sizeof(stub_header));
if (!track->extradata[0])
return AVERROR(ENOMEM);