message: Don't pass a NULL debug string to g_utf8_validate()
authorSebastian Dröge <sebastian@centricular.com>
Tue, 2 May 2017 11:35:50 +0000 (14:35 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 8 May 2017 16:13:03 +0000 (18:13 +0200)
g_utf8_validate() crashes on NULL, but NULL is valid for the debug
string nonetheless.

gst/gstmessage.c

index a1d0d2657bbc7d99a37f29bb7b5e39d513b7d079..ee0de24ca42479737527d08136087070e58ce785 100644 (file)
@@ -415,7 +415,7 @@ gst_message_new_error_with_details (GstObject * src, GError * error,
   GstMessage *message;
   GstStructure *structure;
 
-  if (!g_utf8_validate (debug, -1, NULL)) {
+  if (debug && !g_utf8_validate (debug, -1, NULL)) {
     debug = NULL;
     g_warning ("Trying to set debug field of error message, but "
         "string is not valid UTF-8. Please file a bug.");
@@ -507,7 +507,7 @@ gst_message_new_warning_with_details (GstObject * src, GError * error,
   GstMessage *message;
   GstStructure *structure;
 
-  if (!g_utf8_validate (debug, -1, NULL)) {
+  if (debug && !g_utf8_validate (debug, -1, NULL)) {
     debug = NULL;
     g_warning ("Trying to set debug field of warning message, but "
         "string is not valid UTF-8. Please file a bug.");
@@ -597,7 +597,7 @@ gst_message_new_info_with_details (GstObject * src, GError * error,
   GstMessage *message;
   GstStructure *structure;
 
-  if (!g_utf8_validate (debug, -1, NULL)) {
+  if (debug && !g_utf8_validate (debug, -1, NULL)) {
     debug = NULL;
     g_warning ("Trying to set debug field of info message, but "
         "string is not valid UTF-8. Please file a bug.");