summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2023-03-26 22:16:38 +0200
committerMarton Balint <cus@passwd.hu>2023-04-06 00:40:42 +0200
commit8f534618b5acfb40f146651ba2a3b88fc00eb8b9 (patch)
tree2d3c6f1cd31e22e2a160a2e89ed35900db6497de /libavformat
parent61b27b15fc924d7fa35baa61cfbc91568945f5db (diff)
downloadffmpeg-8f534618b5acfb40f146651ba2a3b88fc00eb8b9.tar.gz
avformat/mxfdec: treat Random Index Pack as end of file
RIP, if exists is the last KLV item in the MXF files therefore we can stop parsing the file if it is encountered. This allows us to support files created by broken muxers such as OpenCube MXFTk Advanced 2.8.0.0.1. which dumps some extra garbage after the RIP. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mxfdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 4530617207..8a7008b298 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3739,7 +3739,10 @@ static int mxf_read_header(AVFormatContext *s)
while (!avio_feof(s->pb)) {
const MXFMetadataReadTableEntry *metadata;
- if (klv_read_packet(&klv, s->pb) < 0) {
+ ret = klv_read_packet(&klv, s->pb);
+ if (ret < 0 || IS_KLV_KEY(klv.key, ff_mxf_random_index_pack_key)) {
+ if (ret >= 0 && avio_size(s->pb) > klv.next_klv)
+ av_log(s, AV_LOG_WARNING, "data after the RandomIndexPack, assuming end of file\n");
/* EOF - seek to previous partition or stop */
if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
break;