mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
ext/pango/gsttextoverlay.c: g_markup_escape_text() REALLY doesn't like non-UTF8 input and doesn't validate its input ...
Original commit message from CVS: * ext/pango/gsttextoverlay.c: (gst_text_overlay_make_utf8), (gst_text_overlay_video_chain): g_markup_escape_text() REALLY doesn't like non-UTF8 input and doesn't validate its input either (and neither did textoverlay it seems). Let's do that then and fix #345206.
This commit is contained in:
parent
702d5980d3
commit
1b54509cf0
2 changed files with 25 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-06-21 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* ext/pango/gsttextoverlay.c: (gst_text_overlay_make_utf8),
|
||||||
|
(gst_text_overlay_video_chain):
|
||||||
|
g_markup_escape_text() REALLY doesn't like non-UTF8 input
|
||||||
|
and doesn't validate its input either (and neither did
|
||||||
|
textoverlay it seems). Let's do that then and fix #345206.
|
||||||
|
|
||||||
2006-06-19 Wim Taymans <wim@fluendo.com>
|
2006-06-19 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/tcp/gstmultifdsink.c: (gst_sync_method_get_type),
|
* gst/tcp/gstmultifdsink.c: (gst_sync_method_get_type),
|
||||||
|
|
|
@ -1324,12 +1324,24 @@ gst_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
/* Push the video frame */
|
/* Push the video frame */
|
||||||
ret = gst_pad_push (overlay->srcpad, buffer);
|
ret = gst_pad_push (overlay->srcpad, buffer);
|
||||||
} else {
|
} else {
|
||||||
const gchar *in_text;
|
gchar *in_text;
|
||||||
gsize in_size;
|
gsize in_size;
|
||||||
|
|
||||||
in_text = (const gchar *) GST_BUFFER_DATA (overlay->text_buffer);
|
in_text = (gchar *) GST_BUFFER_DATA (overlay->text_buffer);
|
||||||
in_size = GST_BUFFER_SIZE (overlay->text_buffer);
|
in_size = GST_BUFFER_SIZE (overlay->text_buffer);
|
||||||
|
|
||||||
|
/* g_markup_escape_text() absolutely requires valid UTF8 input, it
|
||||||
|
* might crash otherwise. We don't fall back on GST_SUBTITLE_ENCODING
|
||||||
|
* here on purpose, this is something that needs fixing upstream */
|
||||||
|
if (!g_utf8_validate (in_text, in_size, NULL)) {
|
||||||
|
const gchar *end = NULL;
|
||||||
|
|
||||||
|
GST_WARNING_OBJECT (overlay, "received invalid UTF-8");
|
||||||
|
in_text = g_strndup (in_text, in_size);
|
||||||
|
while (!g_utf8_validate (in_text, in_size, &end) && end)
|
||||||
|
*((gchar *) end) = '*';
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the string */
|
/* Get the string */
|
||||||
if (overlay->have_pango_markup) {
|
if (overlay->have_pango_markup) {
|
||||||
text = g_strndup (in_text, in_size);
|
text = g_strndup (in_text, in_size);
|
||||||
|
@ -1351,6 +1363,9 @@ gst_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_text_overlay_render_text (overlay, " ", 1);
|
gst_text_overlay_render_text (overlay, " ", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_text != (gchar *) GST_BUFFER_DATA (overlay->text_buffer))
|
||||||
|
g_free (in_text);
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (overlay);
|
GST_OBJECT_UNLOCK (overlay);
|
||||||
ret = gst_text_overlay_push_frame (overlay, buffer);
|
ret = gst_text_overlay_push_frame (overlay, buffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue