From 63dcee34fb6b5e92dd24940a8b53b623d02873b6 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 11 Aug 2022 08:48:08 +0200 Subject: [PATCH] qtdemux: Don't use invalid values from failed trex parsing If parsing the fragment default values (`trex` atom) failed, don't try to compute a bogus sample_description_id value. Fixes #1369 Part-of: --- subprojects/gst-plugins-good/gst/isomp4/qtdemux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index 97ba079..43d2c25 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -3627,11 +3627,13 @@ qtdemux_parse_tfhd (GstQTDemux * qtdemux, GstByteReader * tfhd, goto invalid_track; /* obtain stream defaults */ - qtdemux_parse_trex (qtdemux, *stream, - default_sample_duration, default_sample_size, default_sample_flags); + if (qtdemux_parse_trex (qtdemux, *stream, + default_sample_duration, default_sample_size, default_sample_flags)) { - (*stream)->stsd_sample_description_id = - (*stream)->def_sample_description_index - 1; + /* Default sample description index is only valid if trex parsing succeeded */ + (*stream)->stsd_sample_description_id = + (*stream)->def_sample_description_index - 1; + } if (flags & TF_SAMPLE_DESCRIPTION_INDEX) { guint32 sample_description_index; -- 2.7.4