[FFmpeg-cvslog] avformat/mov.c: require tfhd to begin parsing trun

2019-05-10 Thread chcunningham
ffmpeg | branch: release/3.2 | chcunningham  | Wed 
Feb  6 16:12:51 2019 -0800| [90c194710a6610a6d596877c3f53a11a0cc3a65a] | 
committer: Michael Niedermayer

avformat/mov.c: require tfhd to begin parsing trun

Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in
mov_read_trun().

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3ea87e5d9ea075d5b3c0f4f8c6c48e514b454cbe)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90c194710a6610a6d596877c3f53a11a0cc3a65a
---

 libavformat/isom.h |  1 +
 libavformat/mov.c  | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 9038057820..a512192d81 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -78,6 +78,7 @@ typedef struct MOVAtom {
 struct MOVParseTableEntry;
 
 typedef struct MOVFragment {
+int found_tfhd;
 unsigned track_id;
 uint64_t base_data_offset;
 uint64_t moof_offset;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8e0eb732cb..ae7ef19927 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1157,6 +1157,9 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+// Set by mov_read_tfhd(). mov_read_trun() will reject files missing tfhd.
+c->fragment.found_tfhd = 0;
+
 if (!c->has_looked_for_mfra && c->use_mfra_for > 0) {
 c->has_looked_for_mfra = 1;
 if (pb->seekable) {
@@ -3988,6 +3991,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVFragmentIndex* index = NULL;
 int flags, track_id, i, found = 0;
 
+c->fragment.found_tfhd = 1;
+
 avio_r8(pb); /* version */
 flags = avio_rb24(pb);
 
@@ -4135,6 +4140,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 unsigned entries, first_sample_flags = frag->flags;
 int flags, distance, i, err;
 
+if (!frag->found_tfhd) {
+av_log(c->fc, AV_LOG_ERROR, "trun track id unknown, no tfhd was 
found\n");
+return AVERROR_INVALIDDATA;
+}
+
 for (i = 0; i < c->fc->nb_streams; i++) {
 if (c->fc->streams[i]->id == frag->track_id) {
 st = c->fc->streams[i];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avformat/mov.c: require tfhd to begin parsing trun

2019-03-28 Thread chcunningham
ffmpeg | branch: release/3.4 | chcunningham  | Wed 
Feb  6 16:12:51 2019 -0800| [0063964f84b163495b3569aab13f73f65a7ac1c6] | 
committer: Michael Niedermayer

avformat/mov.c: require tfhd to begin parsing trun

Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in
mov_read_trun().

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3ea87e5d9ea075d5b3c0f4f8c6c48e514b454cbe)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0063964f84b163495b3569aab13f73f65a7ac1c6
---

 libavformat/isom.h |  1 +
 libavformat/mov.c  | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index b9380e9dcc..e50e74b5a3 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -85,6 +85,7 @@ typedef struct MOVAtom {
 struct MOVParseTableEntry;
 
 typedef struct MOVFragment {
+int found_tfhd;
 unsigned track_id;
 uint64_t base_data_offset;
 uint64_t moof_offset;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6e954dd444..27c103ba43 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1170,6 +1170,9 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+// Set by mov_read_tfhd(). mov_read_trun() will reject files missing tfhd.
+c->fragment.found_tfhd = 0;
+
 if (!c->has_looked_for_mfra && c->use_mfra_for > 0) {
 c->has_looked_for_mfra = 1;
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
@@ -4195,6 +4198,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVFragmentIndex* index = NULL;
 int flags, track_id, i, found = 0;
 
+c->fragment.found_tfhd = 1;
+
 avio_r8(pb); /* version */
 flags = avio_rb24(pb);
 
@@ -4342,6 +4347,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 unsigned entries, first_sample_flags = frag->flags;
 int flags, distance, i;
 
+if (!frag->found_tfhd) {
+av_log(c->fc, AV_LOG_ERROR, "trun track id unknown, no tfhd was 
found\n");
+return AVERROR_INVALIDDATA;
+}
+
 for (i = 0; i < c->fc->nb_streams; i++) {
 if (c->fc->streams[i]->id == frag->track_id) {
 st = c->fc->streams[i];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avformat/mov.c: require tfhd to begin parsing trun

2019-03-21 Thread chcunningham
ffmpeg | branch: release/4.0 | chcunningham  | Wed 
Feb  6 16:12:51 2019 -0800| [12a09ce975145c2641877bb0253c0ad905a28f97] | 
committer: Michael Niedermayer

avformat/mov.c: require tfhd to begin parsing trun

Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in
mov_read_trun().

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3ea87e5d9ea075d5b3c0f4f8c6c48e514b454cbe)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12a09ce975145c2641877bb0253c0ad905a28f97
---

 libavformat/isom.h |  1 +
 libavformat/mov.c  | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 4da34142f0..0f81bef4cc 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -85,6 +85,7 @@ typedef struct MOVAtom {
 struct MOVParseTableEntry;
 
 typedef struct MOVFragment {
+int found_tfhd;
 unsigned track_id;
 uint64_t base_data_offset;
 uint64_t moof_offset;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1864810846..60ad594381 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1368,6 +1368,9 @@ static void fix_frag_index_entries(MOVFragmentIndex 
*frag_index, int index,
 
 static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+// Set by mov_read_tfhd(). mov_read_trun() will reject files missing tfhd.
+c->fragment.found_tfhd = 0;
+
 if (!c->has_looked_for_mfra && c->use_mfra_for > 0) {
 c->has_looked_for_mfra = 1;
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
@@ -4531,6 +4534,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVTrackExt *trex = NULL;
 int flags, track_id, i;
 
+c->fragment.found_tfhd = 1;
+
 avio_r8(pb); /* version */
 flags = avio_rb24(pb);
 
@@ -4666,6 +4671,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 AVIndexEntry *new_entries;
 MOVFragmentStreamInfo * frag_stream_info;
 
+if (!frag->found_tfhd) {
+av_log(c->fc, AV_LOG_ERROR, "trun track id unknown, no tfhd was 
found\n");
+return AVERROR_INVALIDDATA;
+}
+
 for (i = 0; i < c->fc->nb_streams; i++) {
 if (c->fc->streams[i]->id == frag->track_id) {
 st = c->fc->streams[i];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mov.c: require tfhd to begin parsing trun

2019-02-09 Thread chcunningham
ffmpeg | branch: release/4.1 | chcunningham  | Wed 
Feb  6 16:12:51 2019 -0800| [bcc71f30adc9de8b02f0b54636f02f20f71ef065] | 
committer: Michael Niedermayer

avformat/mov.c: require tfhd to begin parsing trun

Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in
mov_read_trun().

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3ea87e5d9ea075d5b3c0f4f8c6c48e514b454cbe)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcc71f30adc9de8b02f0b54636f02f20f71ef065
---

 libavformat/isom.h |  1 +
 libavformat/mov.c  | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index e629663949..69452cae8e 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -87,6 +87,7 @@ typedef struct MOVAtom {
 struct MOVParseTableEntry;
 
 typedef struct MOVFragment {
+int found_tfhd;
 unsigned track_id;
 uint64_t base_data_offset;
 uint64_t moof_offset;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index ff7fdd48e2..4b67044219 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1370,6 +1370,9 @@ static void fix_frag_index_entries(MOVFragmentIndex 
*frag_index, int index,
 
 static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+// Set by mov_read_tfhd(). mov_read_trun() will reject files missing tfhd.
+c->fragment.found_tfhd = 0;
+
 if (!c->has_looked_for_mfra && c->use_mfra_for > 0) {
 c->has_looked_for_mfra = 1;
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
@@ -4549,6 +4552,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVTrackExt *trex = NULL;
 int flags, track_id, i;
 
+c->fragment.found_tfhd = 1;
+
 avio_r8(pb); /* version */
 flags = avio_rb24(pb);
 
@@ -4684,6 +4689,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 AVIndexEntry *new_entries;
 MOVFragmentStreamInfo * frag_stream_info;
 
+if (!frag->found_tfhd) {
+av_log(c->fc, AV_LOG_ERROR, "trun track id unknown, no tfhd was 
found\n");
+return AVERROR_INVALIDDATA;
+}
+
 for (i = 0; i < c->fc->nb_streams; i++) {
 if (c->fc->streams[i]->id == frag->track_id) {
 st = c->fc->streams[i];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mov.c: require tfhd to begin parsing trun

2019-02-08 Thread chcunningham
ffmpeg | branch: master | chcunningham  | Wed Feb  6 
16:12:51 2019 -0800| [3ea87e5d9ea075d5b3c0f4f8c6c48e514b454cbe] | committer: 
Michael Niedermayer

avformat/mov.c: require tfhd to begin parsing trun

Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in
mov_read_trun().

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ea87e5d9ea075d5b3c0f4f8c6c48e514b454cbe
---

 libavformat/isom.h |  1 +
 libavformat/mov.c  | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index e629663949..69452cae8e 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -87,6 +87,7 @@ typedef struct MOVAtom {
 struct MOVParseTableEntry;
 
 typedef struct MOVFragment {
+int found_tfhd;
 unsigned track_id;
 uint64_t base_data_offset;
 uint64_t moof_offset;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9b9739f788..6afb656dae 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1366,6 +1366,9 @@ static void fix_frag_index_entries(MOVFragmentIndex 
*frag_index, int index,
 
 static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
+// Set by mov_read_tfhd(). mov_read_trun() will reject files missing tfhd.
+c->fragment.found_tfhd = 0;
+
 if (!c->has_looked_for_mfra && c->use_mfra_for > 0) {
 c->has_looked_for_mfra = 1;
 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
@@ -4544,6 +4547,8 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVTrackExt *trex = NULL;
 int flags, track_id, i;
 
+c->fragment.found_tfhd = 1;
+
 avio_r8(pb); /* version */
 flags = avio_rb24(pb);
 
@@ -4679,6 +4684,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 AVIndexEntry *new_entries;
 MOVFragmentStreamInfo * frag_stream_info;
 
+if (!frag->found_tfhd) {
+av_log(c->fc, AV_LOG_ERROR, "trun track id unknown, no tfhd was 
found\n");
+return AVERROR_INVALIDDATA;
+}
+
 for (i = 0; i < c->fc->nb_streams; i++) {
 if (c->fc->streams[i]->id == frag->track_id) {
 st = c->fc->streams[i];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog