]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Don't parse the ctts atom any more.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 11 Aug 2021 19:02:33 +0000 (21:02 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
The ctts sample offsets are useless for paraslash, so get rid of
the parser.

mp4.c

diff --git a/mp4.c b/mp4.c
index 8d58c1f2b58270371808e020eb0f5eb9855b9b26..e7dbcc7953164fd4f5b81d8ed993caef6f89f912 100644 (file)
--- 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]);
                }
        }