History

avformat/mov: don't use an allocated array for sample_size with HEIF images

The array is only ever needed for streams where each sample entry may have a different value. Given that for non animated HEIF there's a single value that applies to the image, use the field defined for that. Fixes: NULL pointer dereference Fixes: 437528618/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6537287645331456

James Almer committed 1 year ago

Commit abf123b1 parent e97babf1 file · +4 −6Browse files

Unified · Split

libavformat/mov.c+4−6
@@ -5456,10 +5456,6 @@ static int heif_add_stream(MOVContext *c, HEIFItem *item) · 5455 unmodified lines
54565456 if (!sc->chunk_offsets)
54575457 goto fail;
54585458 sc->chunk_count = 1;
5459− sc->sample_sizes = av_malloc_array(1, sizeof(*sc->sample_sizes));
5460− if (!sc->sample_sizes)
5461− goto fail;
5462− sc->sample_count = 1;
54635459 sc->stts_data = av_malloc_array(1, sizeof(*sc->stts_data));
54645460 if (!sc->stts_data)
54655461 goto fail;
@@ -10471,11 +10467,13 @@ static int mov_parse_heif_items(AVFormatContext *s) · 5005 unmodified lines
1047110467 st->codecpar->width = item->width;
1047210468 st->codecpar->height = item->height;
1047310469
10470+ sc->sample_size = sc->stsz_sample_size = item->extent_length;
10471+ sc->sample_count = 1;
10472+
1047410473 err = sanity_checks(s, sc, item->item_id);
10475− if (err || !sc->sample_count)
10474+ if (err)
1047610475 return AVERROR_INVALIDDATA;
1047710476
10478− sc->sample_sizes[0] = item->extent_length;
1047910477 sc->chunk_offsets[0] = item->extent_offset + offset;
1048010478
1048110479 if (item->item_id == mov->primary_item_id)

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