[FFmpeg-cvslog] mxfdec: Move the current_partition check inside mxf_read_header()

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


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

mxfdec: Move the current_partition check inside mxf_read_header()

This fixes SIGSEGV on files where this is the case, such as zzuf4.mxf.

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

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

 libavformat/mxfdec.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 2efd287..f17952b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1535,11 +1535,6 @@ static int mxf_parse_handle_essence(MXFContext *mxf)
     AVIOContext *pb = mxf->fc->pb;
     int64_t ret;
 
-    if (!mxf->current_partition) {
-        av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to PartitionPack\n");
-        return AVERROR_INVALIDDATA;
-    }
-
     if (mxf->parsing_backward) {
         return mxf_seek_to_previous_partition(mxf);
     } else {
@@ -1689,6 +1684,13 @@ static int mxf_read_header(AVFormatContext *s)
             IS_KLV_KEY(klv.key, mxf_essence_element_key) ||
             IS_KLV_KEY(klv.key, mxf_avid_essence_element_key) ||
             IS_KLV_KEY(klv.key, mxf_system_item_key)) {
+
+            if (!mxf->current_partition) {
+                av_log(mxf->fc, AV_LOG_ERROR,
+                       "found essence prior to first PartitionPack\n");
+                return AVERROR_INVALIDDATA;
+            }
+
             if (!mxf->current_partition->essence_offset) {
                 compute_partition_essence_offset(s, mxf, &klv);
             }



More information about the ffmpeg-cvslog mailing list