Commit 1b54509c authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

ext/pango/gsttextoverlay.c: g_markup_escape_text() REALLY doesn't like...

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.
parent 702d5980
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>
 
* 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 */
ret = gst_pad_push (overlay->srcpad, buffer);
} else {
const gchar *in_text;
gchar *in_text;
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);
/* 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 */
if (overlay->have_pango_markup) {
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);
}
if (in_text != (gchar *) GST_BUFFER_DATA (overlay->text_buffer))
g_free (in_text);
GST_OBJECT_UNLOCK (overlay);
ret = gst_text_overlay_push_frame (overlay, buffer);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment