[FFmpeg-cvslog] mxfdec: Sanity check PreviousPartition

Tomas Härdin git at videolan.org
Fri Feb 10 01:47:55 CET 2012


ffmpeg | branch: master | Tomas Härdin <tomas.hardin at codemill.se> | Thu Jan 26 13:21:39 2012 +0100| [df2a85085e599a7184a88d39d69b21aeb6925fdd] | committer: Diego Biurrun

mxfdec: Sanity check PreviousPartition

Without this certain files could get the demuxer stuck in a loop.

Signed-off-by: Diego Biurrun <diego at biurrun.de>

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

 libavformat/mxfdec.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d305e73..582c120 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -484,6 +484,14 @@ 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;



More information about the ffmpeg-cvslog mailing list