dashdemux: correctly handle an HTTP-XSDATE that is exactly the size of the date string
The code in the gst_dash_demux_parse_http_xsdate() was trying to handle the case where the string is not null terminated by resizing the buffer and appending a zero byte. This does not work if the buffer is exactly the length of the string because the gst_buffer_resize() function does not re-allocate the buffer, it just changes its size. If a buffer is passed to gst_dash_demux_parse_http_xsdate() that is exactly the length of the string, the function fails with an assert failure in gst_buffer_resize(). https://bugzilla.gnome.org/show_bug.cgi?id=762148
This commit is contained in:
parent
c0e930c26f
commit
72e46a4478
@ -1992,15 +1992,17 @@ static GstDateTime *
|
|||||||
gst_dash_demux_parse_http_xsdate (GstDashDemuxClockDrift * clock_drift,
|
gst_dash_demux_parse_http_xsdate (GstDashDemuxClockDrift * clock_drift,
|
||||||
GstBuffer * buffer)
|
GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstDateTime *value;
|
GstDateTime *value = NULL;
|
||||||
GstMapInfo mapinfo;
|
GstMapInfo mapinfo;
|
||||||
|
|
||||||
/* the string from the server might not be zero terminated */
|
/* the string from the server might not be zero terminated */
|
||||||
gst_buffer_resize (buffer, 0, gst_buffer_get_size (buffer) + 1);
|
if (gst_buffer_map (buffer, &mapinfo, GST_MAP_READ)) {
|
||||||
gst_buffer_map (buffer, &mapinfo, GST_MAP_READ | GST_MAP_WRITE);
|
gchar *str;
|
||||||
mapinfo.data[mapinfo.size - 1] = '\0';
|
str = g_strndup ((const gchar *) mapinfo.data, mapinfo.size);
|
||||||
value = gst_date_time_new_from_iso8601_string ((const gchar *) mapinfo.data);
|
gst_buffer_unmap (buffer, &mapinfo);
|
||||||
gst_buffer_unmap (buffer, &mapinfo);
|
value = gst_date_time_new_from_iso8601_string (str);
|
||||||
|
g_free (str);
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user