datetime: Sanity check year, month and day when parsing ISO-8601 strings

Passing years > 9999, months > 12 or days > 31 to gst_date_time_new() will
cause an assertion and generally does not make much sense. Instead consider it
as a parsing error like hours > 24 and return NULL.
This commit is contained in:
Sebastian Dröge 2016-04-21 13:49:32 +03:00
parent ab3362f13d
commit 95d6141112

View file

@ -799,7 +799,7 @@ gst_date_time_new_from_iso8601_string (const gchar * string)
month = day = -1;
}
if (ret >= 1 && year <= 0)
if (ret >= 1 && (year <= 0 || year > 9999 || month > 12 || day > 31))
return NULL;
else if (ret >= 1 && len < 16)