mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
dashdemux: parser rejects negative values for mediaPresentationDuration
https://bugzilla.gnome.org/show_bug.cgi?id=752326
This commit is contained in:
parent
7c2746f741
commit
cdfec06092
2 changed files with 40 additions and 0 deletions
|
@ -4136,6 +4136,13 @@ gst_mpd_client_setup_media_presentation (GstMpdClient * client,
|
|||
idx = 0;
|
||||
start = 0;
|
||||
duration = GST_CLOCK_TIME_NONE;
|
||||
|
||||
if (client->mpd_node->mediaPresentationDuration <= 0 &&
|
||||
client->mpd_node->mediaPresentationDuration != -1) {
|
||||
/* Invalid MPD file: MPD duration is negative or zero */
|
||||
goto syntax_error;
|
||||
}
|
||||
|
||||
for (list = client->mpd_node->Periods; list; /* explicitly advanced below */ ) {
|
||||
GstPeriodNode *period_node = list->data;
|
||||
GstPeriodNode *next_period_node = NULL;
|
||||
|
|
|
@ -4599,6 +4599,37 @@ GST_START_TEST (dash_mpdparser_read_unsigned_from_negative_values)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
/*
|
||||
* Test negative mediaPresentationDuration duration
|
||||
*/
|
||||
GST_START_TEST (dash_mpdparser_negative_mediaPresentationDuration)
|
||||
{
|
||||
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\"></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 mediaPresentationDuration
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -4760,6 +4791,8 @@ dash_suite (void)
|
|||
tcase_add_test (tc_negativeTests, dash_mpdparser_negative_period_duration);
|
||||
tcase_add_test (tc_negativeTests,
|
||||
dash_mpdparser_read_unsigned_from_negative_values);
|
||||
tcase_add_test (tc_negativeTests,
|
||||
dash_mpdparser_negative_mediaPresentationDuration);
|
||||
|
||||
tcase_add_test (tc_stringTests, dash_mpdparser_whitespace_strings);
|
||||
tcase_add_test (tc_stringTests, dash_mpdparser_rfc1738_strings);
|
||||
|
|
Loading…
Reference in a new issue