mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
matroskademux: fix trailing '*' displayed with some text subtitles
The subtitle buffer we push out should not include a NUL terminator as part of the data, we just add such a terminator for safety, but it should not be included in the buffer size. A NUL terminator is not valid UTF-8, so checks will fail if it's included in the size, and the NUL will be replaced by the fallback character specified when converting, i.e. '*'. https://bugzilla.gnome.org/show_bug.cgi?id=752421
This commit is contained in:
parent
0421d40d9c
commit
45892ec8be
1 changed files with 2 additions and 1 deletions
|
@ -2993,6 +2993,7 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
|||
/* 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_set_size (newbuf, map.size);
|
||||
gst_buffer_unmap (*buf, &map);
|
||||
|
||||
gst_buffer_copy_into (newbuf, *buf,
|
||||
|
@ -3004,7 +3005,7 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
|||
}
|
||||
|
||||
if (!sub_stream->invalid_utf8) {
|
||||
if (g_utf8_validate ((gchar *) map.data, map.size - 1, NULL)) {
|
||||
if (g_utf8_validate ((gchar *) map.data, map.size, NULL)) {
|
||||
goto next;
|
||||
}
|
||||
GST_WARNING_OBJECT (element, "subtitle stream %" G_GUINT64_FORMAT
|
||||
|
|
Loading…
Reference in a new issue