[FFmpeg-devel] [PATCH 2/2] avformat/mxfdec: do not use AnyType when resolving Descriptors and MultipleDescriptors
Marton Balint
cus at passwd.hu
Fri Feb 16 23:18:04 EET 2024
Using AnyType should not be a problem for proper MXF files because UIDs are
supposed to be unique themselves. Unfortunately that is not the case for some
broken files, so let's check the type more strictly.
Fixes ticket #10865.
Signed-off-by: Marton Balint <cus at passwd.hu>
---
libavformat/mxfdec.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 4e4e3e7a84..446bcf3276 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2258,16 +2258,14 @@ static MXFPackage* mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U
static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, int track_id)
{
- MXFDescriptor *descriptor, *file_descriptor = NULL;
- int i;
-
- descriptor = mxf_resolve_strong_ref(mxf, strong_ref, AnyType);
- if (!descriptor)
- return NULL;
+ MXFDescriptor *descriptor = mxf_resolve_strong_ref(mxf, strong_ref, Descriptor);
+ if (descriptor)
+ return descriptor;
- if (descriptor->meta.type == MultipleDescriptor) {
- for (i = 0; i < descriptor->file_descriptors_count; i++) {
- file_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->file_descriptors_refs[i], Descriptor);
+ descriptor = mxf_resolve_strong_ref(mxf, strong_ref, MultipleDescriptor);
+ if (descriptor) {
+ for (int i = 0; i < descriptor->file_descriptors_count; i++) {
+ MXFDescriptor *file_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->file_descriptors_refs[i], Descriptor);
if (!file_descriptor) {
av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file descriptor strong ref\n");
@@ -2277,8 +2275,7 @@ static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, i
return file_descriptor;
}
}
- } else if (descriptor->meta.type == Descriptor)
- return descriptor;
+ }
return NULL;
}
--
2.35.3
More information about the ffmpeg-devel
mailing list