diff options
author | Tomas Härdin <tomas.hardin@codemill.se> | 2011-12-21 10:56:59 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-03 20:52:21 +0100 |
commit | 5c2097cff79c66cb1a3aa7f49133fa265d9fb633 (patch) | |
tree | 74b16efd94e525a93090ac90017da8f25eb0a66d | |
parent | 6a8826abf4aa9818b3a6e1d94f661be9fdce9032 (diff) | |
download | ffmpeg-5c2097cff79c66cb1a3aa7f49133fa265d9fb633.tar.gz |
mxfdec: Sanity check PreviousPartition
Without this certain files could get the demuxer stuck in a loop
(cherry picked from commit 46d65fb8a574465499a470d0c34a30902e45176a)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mxfdec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index fe3a7ccdfa..e97b2a45f4 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -577,6 +577,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; |