mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
dashdemux: parser rejects XMLs with negative period duration
https://bugzilla.gnome.org/show_bug.cgi?id=752329
This commit is contained in:
parent
60133b1472
commit
c763d1e8fd
2 changed files with 39 additions and 0 deletions
|
@ -4195,6 +4195,10 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client,
|
|||
}
|
||||
duration = next_period_node->start * GST_MSECOND - start;
|
||||
} else if (period_node->duration != -1) {
|
||||
if (period_node->duration <= 0) {
|
||||
/* Invalid MPD file: duration would be negative or zero */
|
||||
goto syntax_error;
|
||||
}
|
||||
duration = period_node->duration * GST_MSECOND;
|
||||
} else if (client->mpd_node->type == GST_MPD_FILE_TYPE_DYNAMIC) {
|
||||
/* might be a live file, ignore unspecified duration */
|
||||
|
|
|
@ -4490,6 +4490,40 @@ GST_START_TEST (dash_mpdparser_rfc1738_strings)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
/*
|
||||
* Test negative period duration
|
||||
*/
|
||||
GST_START_TEST (dash_mpdparser_negative_period_duration)
|
||||
{
|
||||
const gchar *xml =
|
||||
"<?xml version=\"1.0\"?>"
|
||||
"<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
|
||||
" profiles=\"urn:mpeg:dash:profile:isoff-main:2011\""
|
||||
" availabilityStartTime=\"2015-03-24T0:0:0\""
|
||||
" mediaPresentationDuration=\"P0Y0M0DT3H3M30S\">"
|
||||
" <Period id=\"Period0\""
|
||||
" start=\"P0Y0M0DT1H0M0S\""
|
||||
" duration=\"-PT10S\">"
|
||||
" </Period><Period id=\"Period1\"></Period></MPD>";
|
||||
|
||||
gboolean ret;
|
||||
GstMpdClient *mpdclient = gst_mpd_client_new ();
|
||||
|
||||
ret = gst_mpd_parse (mpdclient, xml, (gint) strlen (xml));
|
||||
assert_equals_int (ret, TRUE);
|
||||
|
||||
/* process the xml data
|
||||
* should fail due to negative duration of Period0
|
||||
*/
|
||||
ret = gst_mpd_client_setup_media_presentation (mpdclient, GST_CLOCK_TIME_NONE,
|
||||
-1, NULL);
|
||||
assert_equals_int (ret, FALSE);
|
||||
|
||||
gst_mpd_client_free (mpdclient);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
/*
|
||||
* create a test suite containing all dash testcases
|
||||
*/
|
||||
|
@ -4648,6 +4682,7 @@ dash_suite (void)
|
|||
dash_mpdparser_wrong_period_duration_inferred_from_next_period);
|
||||
tcase_add_test (tc_negativeTests,
|
||||
dash_mpdparser_wrong_period_duration_inferred_from_next_mediaPresentationDuration);
|
||||
tcase_add_test (tc_negativeTests, dash_mpdparser_negative_period_duration);
|
||||
|
||||
tcase_add_test (tc_stringTests, dash_mpdparser_whitespace_strings);
|
||||
tcase_add_test (tc_stringTests, dash_mpdparser_rfc1738_strings);
|
||||
|
|
Loading…
Reference in a new issue