gst/gstregistryxml.c: Make sure we don't pass non-UTF-8 strings to g_markup_escape(), since that can lead to random m...

Original commit message from CVS:
* gst/gstregistryxml.c: (gst_registry_save_escaped):
Make sure we don't pass non-UTF-8 strings to g_markup_escape(),
since that can lead to random memory corruptions and crashes
(may or may not be related to #383244, #386711, and #386711).
This commit is contained in:
Tim-Philipp Müller 2006-12-26 15:06:52 +00:00
parent 8bfabdfe1c
commit 5c3731ea37
2 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2006-12-26 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstregistryxml.c: (gst_registry_save_escaped):
Make sure we don't pass non-UTF-8 strings to g_markup_escape(),
since that can lead to random memory corruptions and crashes
(may or may not be related to #383244, #386711, and #386711).
2006-12-21 Stefan Kost <ensonic@users.sf.net>
* tests/check/.cvsignore:

View file

@ -594,7 +594,14 @@ gst_registry_save_escaped (GstRegistry * registry, char *prefix, char *tag,
gboolean ret = TRUE;
if (value) {
gchar *v = g_markup_escape_text (value, strlen (value));
gchar *v;
if (g_utf8_validate (value, -1, NULL)) {
v = g_markup_escape_text (value, -1);
} else {
g_warning ("Invalid UTF-8 while saving registry tag '%s'", tag);
v = g_strdup ("[ERROR: invalid UTF-8]");
}
ret = gst_registry_save (registry, "%s<%s>%s</%s>\n", prefix, tag, v, tag);
g_free (v);