[PATCH] fixed #1659
authorjeanlf <jeanlf@gpac.io>
Mon, 4 Jan 2021 10:06:52 +0000 (11:06 +0100)
committerReinhard Tartler <siretart@tauware.de>
Tue, 25 May 2021 01:09:10 +0000 (21:09 -0400)
Gbp-Pq: Name CVE-2020-35981.patch

src/isomedia/isom_store.c

index 80a6b5c87469188557ea94eb52551477d6619100..54a606242d9903116d2db304b693176aeff6f4f1 100644 (file)
@@ -150,8 +150,14 @@ GF_Err SetupWriters(MovieWriter *mw, GF_List *writers, u8 interleaving)
 
        trackCount = gf_list_count(movie->moov->trackList);
        for (i = 0; i < trackCount; i++) {
+               GF_SampleTableBox *stbl;
                trak = gf_isom_get_track(movie->moov, i+1);
 
+               stbl = (trak->Media && trak->Media->information) ? trak->Media->information->sampleTable : NULL;
+               if (!stbl || !stbl->SampleSize || !stbl->ChunkOffset || !stbl->SampleToChunk) {
+                       return GF_ISOM_INVALID_FILE;
+               }
+
                GF_SAFEALLOC(writer, TrackWriter);
                if (!writer) goto exit;
                writer->sampleNumber = 1;