From 047bf82c181c1220b3087b37f28445f8b87a7a23 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sun, 15 Nov 2015 17:46:08 +0100 Subject: [PATCH] mxfdec: check edit_rate also for physical_track Previously only the edit_rate of material_track was checked. If it's negative, it causes assertion failures in av_rescale_rnd. Reviewed-by: Tim Nicholson Signed-off-by: Andreas Cadhalpun --- libavformat/mxfdec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 99c8fede02..429f46a7e9 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1776,6 +1776,16 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t continue; } + if (physical_track->edit_rate.num <= 0 || + physical_track->edit_rate.den <= 0) { + av_log(mxf->fc, AV_LOG_WARNING, + "Invalid edit rate (%d/%d) found on structural" + " component #%d, defaulting to 25/1\n", + physical_track->edit_rate.num, + physical_track->edit_rate.den, i); + physical_track->edit_rate = (AVRational){25, 1}; + } + for (k = 0; k < physical_track->sequence->structural_components_count; k++) { if (!(mxf_tc = mxf_resolve_timecode_component(mxf, &physical_track->sequence->structural_components_refs[k]))) continue;