From 106252353bf277d64180c6748b3056b1d91e1a63 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 11 Aug 2021 21:02:33 +0200 Subject: [PATCH] mp4: Don't parse the ctts atom any more. The ctts sample offsets are useless for paraslash, so get rid of the parser. --- mp4.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/mp4.c b/mp4.c index 8d58c1f2..e7dbcc79 100644 --- a/mp4.c +++ b/mp4.c @@ -41,11 +41,6 @@ struct mp4_track { int32_t stco_entry_count; int32_t *stco_chunk_offset; - /* ctts */ - int32_t ctts_entry_count; - int32_t *ctts_sample_count; - int32_t *ctts_sample_offset; - uint32_t maxBitrate; uint32_t avgBitrate; @@ -488,34 +483,6 @@ static int32_t read_stts(struct mp4 *f) return 1; } -static int32_t read_ctts(struct mp4 *f) -{ - int32_t i; - struct mp4_track *t; - - if (f->total_tracks == 0) - return f->error++; - t = f->track[f->total_tracks - 1]; - if (t->ctts_entry_count) - return 0; - - read_char(f); /* version */ - read_int24(f); /* flags */ - t->ctts_entry_count = read_int32(f); - - t->ctts_sample_count = para_malloc(t->ctts_entry_count - * sizeof (int32_t)); - t->ctts_sample_offset = para_malloc(t->ctts_entry_count - * sizeof (int32_t)); - - /* CVE-2017-9257 */ - for (i = 0; i < t->ctts_entry_count && !f->stream->read_error; i++) { - t->ctts_sample_count[i] = read_int32(f); - t->ctts_sample_offset[i] = read_int32(f); - } - return 1; -} - static int32_t read_stsc(struct mp4 *f) { int32_t i; @@ -1016,9 +983,6 @@ static int32_t atom_read(struct mp4 *f, int32_t size, uint8_t atom_type) } else if (atom_type == ATOM_STTS) { /* time to sample box */ read_stts(f); - } else if (atom_type == ATOM_CTTS) { - /* composition offset box */ - read_ctts(f); } else if (atom_type == ATOM_STSC) { /* sample to chunk box */ read_stsc(f); @@ -1152,8 +1116,6 @@ void mp4_close(struct mp4 *ff) free(ff->track[i]->stsc_samples_per_chunk); free(ff->track[i]->stsc_sample_desc_index); free(ff->track[i]->stco_chunk_offset); - free(ff->track[i]->ctts_sample_count); - free(ff->track[i]->ctts_sample_offset); free(ff->track[i]); } } -- 2.39.5