mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
matroska-demux: Make sure that subtitle buffers are \0-terminated
https://bugzilla.gnome.org/show_bug.cgi?id=707933
This commit is contained in:
parent
cfefdaebb6
commit
d8841b4832
1 changed files with 17 additions and 0 deletions
|
@ -3060,6 +3060,23 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
|||
gst_buffer_map (*buf, &map, GST_MAP_READ);
|
||||
|
||||
next:
|
||||
/* Need \0-terminator at the end */
|
||||
if (map.data[map.size - 1] != '\0') {
|
||||
newbuf = gst_buffer_new_and_alloc (map.size + 1);
|
||||
|
||||
/* Copy old buffer and add a 0 at the end */
|
||||
gst_buffer_fill (newbuf, 0, map.data, map.size);
|
||||
gst_buffer_memset (newbuf, map.size, 0, 1);
|
||||
gst_buffer_unmap (*buf, &map);
|
||||
|
||||
gst_buffer_copy_into (newbuf, *buf,
|
||||
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS |
|
||||
GST_BUFFER_COPY_META, 0, -1);
|
||||
gst_buffer_unref (*buf);
|
||||
*buf = newbuf;
|
||||
gst_buffer_map (*buf, &map, GST_MAP_READ);
|
||||
}
|
||||
|
||||
if (sub_stream->check_markup) {
|
||||
/* caps claim markup text, so we need to escape text,
|
||||
* except if text is already markup and then needs no further escaping */
|
||||
|
|
Loading…
Reference in a new issue