History

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

Ensures no bogus values being preserved after returning.

James Almer committed 1 year ago

Commit 64e6f5d1 parent 7039a371 file · +3 −3Browse files

Unified · Split

libavformat/mov.c+3−3
@@ -5430,18 +5430,18 @@ static int heif_add_stream(MOVContext *c, HEIFItem *item) · 5429 unmodified lines
5430 sc->stsc_data[0].first = 1;5430 sc->stsc_data[0].first = 1;
5431 sc->stsc_data[0].count = 1;5431 sc->stsc_data[0].count = 1;
5432 sc->stsc_data[0].id = 1;5432 sc->stsc_data[0].id = 1;
5433 sc->chunk_count = 1;
5434 sc->chunk_offsets = av_malloc_array(1, sizeof(*sc->chunk_offsets));5433 sc->chunk_offsets = av_malloc_array(1, sizeof(*sc->chunk_offsets));
5435 if (!sc->chunk_offsets)5434 if (!sc->chunk_offsets)
5436 return AVERROR(ENOMEM);5435 return AVERROR(ENOMEM);
5437 sc->sample_count = 1;5436 sc->chunk_count = 1;
5438 sc->sample_sizes = av_malloc_array(1, sizeof(*sc->sample_sizes));5437 sc->sample_sizes = av_malloc_array(1, sizeof(*sc->sample_sizes));
5439 if (!sc->sample_sizes)5438 if (!sc->sample_sizes)
5440 return AVERROR(ENOMEM);5439 return AVERROR(ENOMEM);
5441 sc->stts_count = 1;5440 sc->sample_count = 1;
5442 sc->stts_data = av_malloc_array(1, sizeof(*sc->stts_data));5441 sc->stts_data = av_malloc_array(1, sizeof(*sc->stts_data));
5443 if (!sc->stts_data)5442 if (!sc->stts_data)
5444 return AVERROR(ENOMEM);5443 return AVERROR(ENOMEM);
5444 sc->stts_count = 1;
5445 sc->stts_data[0].count = 1;5445 sc->stts_data[0].count = 1;
5446 // Not used for still images. But needed by mov_build_index.5446 // Not used for still images. But needed by mov_build_index.
5447 sc->stts_data[0].duration = 0;5447 sc->stts_data[0].duration = 0;

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