summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorTomas Härdin <tomas.hardin@codemill.se>2011-12-21 10:56:59 +0100
committerTomas Härdin <tomas.hardin@codemill.se>2011-12-21 14:17:44 +0100
commit46d65fb8a574465499a470d0c34a30902e45176a (patch)
treedcc2c35937cdced4bf71295216fe6162970cdfa4 /libavformat
parente7839602f469eb9dd5e1341d780c0c1667ac89ad (diff)
mxfdec: Sanity check PreviousPartition
Without this certain files could get the demuxer stuck in a loop
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mxfdec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index e1363747a9..15c2a21e1d 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -479,6 +479,13 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
partition->previous_partition, footer_partition,
partition->index_sid, partition->body_sid);
+ /* sanity check PreviousPartition if set */
+ if (partition->previous_partition &&
+ mxf->run_in + partition->previous_partition >= klv_offset) {
+ av_log(mxf->fc, AV_LOG_ERROR, "PreviousPartition points to this partition or forward\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (op[12] == 1 && op[13] == 1) mxf->op = OP1a;
else if (op[12] == 1 && op[13] == 2) mxf->op = OP1b;
else if (op[12] == 1 && op[13] == 3) mxf->op = OP1c;