diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2014-03-13 19:12:05 +0400 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-03-19 14:56:33 +0400 |
commit | 842ea36c747eb6537c4236114346cb7a3e9a8df1 (patch) | |
tree | f0798b22167c2890c786b9bcee74ccaa52667f62 /libavformat | |
parent | 92ebb332157195b7c1212e734c5668afbf19cf2b (diff) |
mxf: Override faulty PreviousPartition entries
Some files set the PreviousPartition field to point to its own offset.
If we are parsing forward the Previous partition is immediately known
and its value could be used, otherwise we can safely point to the
header.
Reported-By: Jean Baptiste Kempf <jb@videolan.org>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mxfdec.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 734c50a3ad..39ab4628c2 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -478,6 +478,26 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size avio_read(pb, op, sizeof(UID)); nb_essence_containers = avio_rb32(pb); + if (partition->this_partition && + partition->previous_partition == partition->this_partition) { + av_log(mxf->fc, AV_LOG_ERROR, + "PreviousPartition equal to ThisPartition %"PRIx64"\n", + partition->previous_partition); + /* override with the actual previous partition offset */ + if (!mxf->parsing_backward && mxf->last_forward_partition > 1) { + MXFPartition *prev = + mxf->partitions + mxf->last_forward_partition - 2; + partition->previous_partition = prev->this_partition; + } + /* if no previous body partition are found point to the header + * partition */ + if (partition->previous_partition == partition->this_partition); + partition->previous_partition = 0; + av_log(mxf->fc, AV_LOG_ERROR, + "Overriding PreviousPartition with %"PRIx64"\n", + partition->previous_partition); + } + /* some files don'thave FooterPartition set in every partition */ if (footer_partition) { if (mxf->footer_partition && mxf->footer_partition != footer_partition) { |