mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
gst/gststructure.c: If someone tries to set a non-UTF8 string field on a structure, don't just print a warning, but a...
Original commit message from CVS: * gst/gststructure.c: (gst_structure_id_set_value): If someone tries to set a non-UTF8 string field on a structure, don't just print a warning, but also ignore the request and do not change/add that field to the structure. * tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite): Test for the above.
This commit is contained in:
parent
bc18910072
commit
c7fc3dc0e8
3 changed files with 31 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2006-10-26 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/gststructure.c: (gst_structure_id_set_value):
|
||||
If someone tries to set a non-UTF8 string field on a structure,
|
||||
don't just print a warning, but also ignore the request and do
|
||||
not change/add that field to the structure.
|
||||
|
||||
* tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite):
|
||||
Test for the above.
|
||||
|
||||
2006-10-25 David Schleef <ds@schleef.org>
|
||||
|
||||
* gst/gstinfo.c:
|
||||
|
|
|
@ -400,6 +400,7 @@ gst_structure_id_set_value (GstStructure * structure,
|
|||
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));
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -241,6 +241,25 @@ GST_START_TEST (test_type)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_set_non_utf8_string)
|
||||
{
|
||||
GstTagList *taglist;
|
||||
guint8 foobar[2] = { 0xff, 0x00 }; /* not UTF-8 */
|
||||
|
||||
taglist = gst_tag_list_new ();
|
||||
fail_unless (taglist != NULL);
|
||||
|
||||
ASSERT_WARNING (gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND,
|
||||
GST_TAG_ARTIST, (gchar *) foobar, NULL));
|
||||
|
||||
/* That string field with a non-UTF8 string should not have been added */
|
||||
fail_unless (gst_tag_list_is_empty (taglist));
|
||||
|
||||
gst_tag_list_free (taglist);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
gst_tag_suite (void)
|
||||
{
|
||||
|
@ -251,6 +270,7 @@ gst_tag_suite (void)
|
|||
tcase_add_test (tc_chain, test_merge);
|
||||
tcase_add_test (tc_chain, test_date_tags);
|
||||
tcase_add_test (tc_chain, test_type);
|
||||
tcase_add_test (tc_chain, test_set_non_utf8_string);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue