[sound-juicer] Fix crash on FreeBSD



commit 4ee58ce895d3c04db92b08ef3ba403a35c639a8d
Author: Peter Johanson <peter peterjohanson com>
Date:   Sat Dec 27 00:19:00 2014 -0500

    Fix crash on FreeBSD
    
    Passing a NULL string to mb5_query_set_proxyhost(),
    mb5_query_set_proxyusername() or mb5_query_set_proxypassword() causes a
    crash on FreeBSD so pass an empty string instead. This is caused by
    libmusicbrainz passing the NULL string to the constructor of std::string
    which is undefined behaviour in the C++ standard.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742019

 libjuicer/sj-metadata-musicbrainz5.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/libjuicer/sj-metadata-musicbrainz5.c b/libjuicer/sj-metadata-musicbrainz5.c
index c886fff..7f81712 100644
--- a/libjuicer/sj-metadata-musicbrainz5.c
+++ b/libjuicer/sj-metadata-musicbrainz5.c
@@ -977,10 +977,14 @@ setup_http_proxy (SjMetadataMusicbrainz5Private *priv)
   if (priv->proxy_mode == G_DESKTOP_PROXY_MODE_NONE ||
       priv->proxy_mode == G_DESKTOP_PROXY_MODE_AUTO ||
       priv->proxy_host == NULL || priv->proxy_port == 0) {
-    mb5_query_set_proxyhost (priv->mb, NULL);
+    /* NB passing a NULL string to mb5_query_set_proxyhost,
+       mb5_query_set_proxyusername or mb5_query_set_proxypassword
+       causes a crash on FreeBSD
+       https://bugzilla.gnome.org/show_bug.cgi?id=742019 */
+    mb5_query_set_proxyhost (priv->mb, "");
     mb5_query_set_proxyport (priv->mb, 0);
-    mb5_query_set_proxyusername (priv->mb, NULL);
-    mb5_query_set_proxypassword (priv->mb, NULL);
+    mb5_query_set_proxyusername (priv->mb, "");
+    mb5_query_set_proxypassword (priv->mb, "");
     if (priv->proxy_mode == G_DESKTOP_PROXY_MODE_AUTO)
       g_warning ("Automatic proxy mode not supported yet, disabling proxy usage");
   } else if (priv->proxy_mode == G_DESKTOP_PROXY_MODE_MANUAL) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]