mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
datetime: fix potential out-of-bound read on malformed datetime string
https://bugzilla.gnome.org/show_bug.cgi?id=777263
This commit is contained in:
parent
7a5bde14a1
commit
0a1baf6d07
2 changed files with 9 additions and 1 deletions
|
@ -865,7 +865,7 @@ gst_date_time_new_from_iso8601_string (const gchar * string)
|
||||||
else if (neg_pos)
|
else if (neg_pos)
|
||||||
pos = neg_pos + 1;
|
pos = neg_pos + 1;
|
||||||
|
|
||||||
if (pos) {
|
if (pos && strlen (pos) >= 3) {
|
||||||
gint ret_tz;
|
gint ret_tz;
|
||||||
if (pos[2] == ':')
|
if (pos[2] == ':')
|
||||||
ret_tz = sscanf (pos, "%d:%d", &gmt_offset_hour, &gmt_offset_min);
|
ret_tz = sscanf (pos, "%d:%d", &gmt_offset_hour, &gmt_offset_min);
|
||||||
|
|
|
@ -701,6 +701,14 @@ GST_START_TEST (test_GstDateTime_iso8601)
|
||||||
fail_unless (!gst_date_time_has_second (dt));
|
fail_unless (!gst_date_time_has_second (dt));
|
||||||
gst_date_time_unref (dt);
|
gst_date_time_unref (dt);
|
||||||
|
|
||||||
|
/* some bogus ones, make copy to detect out of bound read in valgrind/asan */
|
||||||
|
{
|
||||||
|
gchar *s = g_strdup ("0002000000T00000:00+0");
|
||||||
|
dt = gst_date_time_new_from_iso8601_string (s);
|
||||||
|
gst_date_time_unref (dt);
|
||||||
|
g_free (s);
|
||||||
|
}
|
||||||
|
|
||||||
g_date_time_unref (gdt2);
|
g_date_time_unref (gdt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue