gst/gststructure.c: Make sure that string fields in structures/taglists contain valid UTF-8 - we don't want to pass r...

Original commit message from CVS:
* gst/gststructure.c: (gst_structure_id_set_value):
Make sure that string fields in structures/taglists
contain valid UTF-8 - we don't want to pass rubbish to
applications because of a buggy plugin (cp. #334167).
This commit is contained in:
Tim-Philipp Müller 2006-03-21 14:24:41 +00:00
parent ac377b0cdc
commit 1f1dfef0dc
2 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,11 @@
2006-03-21 Edward Hervey <edward@fluendo.com> 2006-03-21 Tim-Philipp Müller <tim at centricular dot net>
reviewed by: <delete if not using a buddy> * gst/gststructure.c: (gst_structure_id_set_value):
Make sure that string fields in structures/taglists
contain valid UTF-8 - we don't want to pass rubbish to
applications because of a buggy plugin (cp. #334167).
2006-03-21 Edward Hervey <edward@fluendo.com>
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func), * gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_handle_message_func): (gst_bin_handle_message_func):

View file

@ -388,6 +388,20 @@ gst_structure_id_set_value (GstStructure * structure,
g_return_if_fail (G_IS_VALUE (value)); g_return_if_fail (G_IS_VALUE (value));
g_return_if_fail (IS_MUTABLE (structure)); g_return_if_fail (IS_MUTABLE (structure));
/* if someones disables GST_DEBUG output, they probably do it for
* performance reasons, so skip the UTF-8 check here as well then */
#ifndef GST_DISABLE_GST_DEBUG
if (G_VALUE_HOLDS_STRING (value)) {
const gchar *s;
s = g_value_get_string (value);
if (s != NULL && !g_utf8_validate (s, -1, NULL)) {
g_warning ("Trying to set string field '%s' on structure, but string is "
"not valid UTF-8. Please file a bug.", g_quark_to_string (field));
}
}
#endif
gsfield.name = field; gsfield.name = field;
gst_value_init_and_copy (&gsfield.value, value); gst_value_init_and_copy (&gsfield.value, value);