1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avformat/mov: set array entry count after the array is allocated in heif_add_stream()

Ensures no bogus values being preserved after returning.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-06-20 13:25:15 -03:00
parent 7039a37e35
commit 64e6f5d5fa

View File

@ -5430,18 +5430,18 @@ static int heif_add_stream(MOVContext *c, HEIFItem *item)
sc->stsc_data[0].first = 1; sc->stsc_data[0].first = 1;
sc->stsc_data[0].count = 1; sc->stsc_data[0].count = 1;
sc->stsc_data[0].id = 1; sc->stsc_data[0].id = 1;
sc->chunk_count = 1;
sc->chunk_offsets = av_malloc_array(1, sizeof(*sc->chunk_offsets)); sc->chunk_offsets = av_malloc_array(1, sizeof(*sc->chunk_offsets));
if (!sc->chunk_offsets) if (!sc->chunk_offsets)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
sc->sample_count = 1; sc->chunk_count = 1;
sc->sample_sizes = av_malloc_array(1, sizeof(*sc->sample_sizes)); sc->sample_sizes = av_malloc_array(1, sizeof(*sc->sample_sizes));
if (!sc->sample_sizes) if (!sc->sample_sizes)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
sc->stts_count = 1; sc->sample_count = 1;
sc->stts_data = av_malloc_array(1, sizeof(*sc->stts_data)); sc->stts_data = av_malloc_array(1, sizeof(*sc->stts_data));
if (!sc->stts_data) if (!sc->stts_data)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
sc->stts_count = 1;
sc->stts_data[0].count = 1; sc->stts_data[0].count = 1;
// Not used for still images. But needed by mov_build_index. // Not used for still images. But needed by mov_build_index.
sc->stts_data[0].duration = 0; sc->stts_data[0].duration = 0;