diff options
author | Tomas Härdin <tomas.hardin@codemill.se> | 2011-12-20 18:11:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-03 20:51:52 +0100 |
commit | 6a8826abf4aa9818b3a6e1d94f661be9fdce9032 (patch) | |
tree | 6961f58f7d0c94183b8b0ff27e768728968563e5 | |
parent | 46e4dd66dafda925748c40238904040fe20d5407 (diff) | |
download | ffmpeg-6a8826abf4aa9818b3a6e1d94f661be9fdce9032.tar.gz |
mxfdec: Move the current_partition check inside mxf_read_header()
This fixes SIGSEGV on files where this is actually the case, such as zzuf4.mxf
(cherry picked from commit 184f479096dabcb1eafd9c661304f410a76780ed)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mxfdec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 58bda9a85f..fe3a7ccdfa 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1500,11 +1500,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 { @@ -1618,6 +1613,12 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_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) { /* for OP1a we compute essence_offset * for OPAtom we point essence_offset after the KL (usually op1a_essence_offset + 20 or 25) |