Project

General

Profile

Actions

Bug #2991

open

CHIRP crashes due to bad UTF-8 in memory names

Added by Rafael O over 8 years ago.

Status:
New
Priority:
High
Assignee:
-
Category:
-
Target version:
-
Start date:
11/10/2015
Due date:
% Done:

0%

Estimated time:
Chirp Version:
daily
Model affected:
(All models)
Platform:
MacOS
Debug Log:
I read the instructions above:

Description

This may be the underlying issue in http://chirp.danplanet.com/issues/2905, as it was discovered in the same manner and with the same AnyTone driver.

When attempting to display (memory editor, export, etc) memory locations with invalid UTF-8 in the channel 'name' column, CHiRP will cause Python to seg fault with 'Bus error: 10'. The last message logged to console is a 'PangoWarning' emitted when trying to call gtk.

I am not familiar enough with the project to suggest a long-term fix but, for testing, I applied a quick patch to memedit.py to replace the invalid UTF strings, and confirmed this does stop CHiRP from crashing.

[output from attempted export]

chirp-daily-20151023.app/Contents/Resources/chirp/chirp/ui/editorset.py:252: PangoWarning: Invalid UTF-8 string passed to pango_layout_set_text()
  r = dialog.run()
Bus error: 10

[quick patch for testing]

$ diff -u memedit.py.original memedit.py
--- memedit.py.original 2015-11-10 03:32:55.000000000 -0800
+++ memedit.py  2015-11-10 03:34:15.000000000 -0800
@@ -428,7 +428,15 @@
     def render(self, _, rend, model, iter, colnum):
         val, hide = model.get(iter, colnum, self.col("_hide_cols"))
         val = self._render(colnum, val, iter, hide or [])
-        rend.set_property("text", "%s" % val)
+        
+        if (isinstance(val,str)):
+            try:
+                utf_val = val.decode('utf-8')
+            except UnicodeDecodeError:
+                LOG.debug("Invalid UTF for column %d: [%s]" % (colnum,val))
+                val = "BADUTF"     
+        
+        rend.set_property("text", "%s" % val)    
 
     def insert_new(self, iter, loc=None):
         line = []

Related issues

Related to Bug #2905: Chirp crashes when changing memory range on OS X New10/07/2015

Actions

No data to display

Actions

Also available in: Atom PDF