GNOME Bugzilla – Bug 712749
g-c-c network panel crashes in g_markup_escape_text()
Last modified: 2018-01-23 15:20:20 UTC
Created attachment 260331 [details] [review] make the SSID conversion to a string properly output utf8 From downstream bug: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1198315 Seems like gnome-control-center is using, for the network panel, the nm_utils_escape_ssid() function which is really only meant for debugging purposes according to the API documentation, and not guaranteed to return a valid UTF-8 string. It would be better to use nm_utils_ssid_to_utf8() instead (that's already used in other parts of the network panel). The attached patch seems to fix the issue for me in 3.6.3. Part of the stacktrace: append_escaped_text (length=<optimized out>, text=<optimized out>, str=0x7f9816ba8f80) at /build/buildd/glib2.0-2.37.3/./glib/gmarkup.c:2148 g_markup_escape_text (text=text@entry=0x7f97df57dec0 <escaped.16720> "B\374ro", length=<optimized out>, length@entry=-1) at /build/buildd/glib2.0-2.37.3/./glib/gmarkup.c:2224 add_saved_connection (nm_device=<optimized out>, connection=0x7f9800003f00, device_wifi=0x7f9816df66d0) at net-device-wifi.c:535 device_wifi_refresh_saved_connections (device_wifi=device_wifi@entry=0x7f9816df66d0) at net-device-wifi.c:582 remote_settings_read_cb (remote_settings=<optimized out>, device_wifi=0x7f9816df66d0) at net-device-wifi.c:1787
Review of attachment 260331 [details] [review]: Not all the cases where you're replacing nm_utils_escape_ssid() should be using nm_utils_ssid_to_utf8(). Comparisons between SSIDs shouldn't use nm_utils_ssid_to_utf8(), only debug messages or other user-visible strings should. And, 3.6? I'd be more interested in a patch to master. ::: panels/network/net-device-wifi.c @@ +1126,3 @@ } + g_free (ssid_tmp); g_free() on a const?
Indeed, they probably should not, but you're comparing against the title which is a user-visible string... Nice catch re. const, I hadn't noticed. I'll get you an updated patch for master asap.
Created attachment 260451 [details] [review] patch for 3.6.3
Review of attachment 260451 [details] [review]: Hi Mathieu, thanks for your patch and sorry for the delay. This patch does not apply anymore, would you please rebase it against master?
As far as I can tell, this is no longer an issue. The patch does not apply because there is no longer a use of an SSID retrieved from NM directly without going by nm_utils_ssid_to_utf8() before displaying in the UI.