Ignore invalid utf-8 characters in symbolize.py
Currently symbolize.py will crash when handling invalid UTF-8
characters. This happens when an Android application outputs
extended characters such as "\xC0".
Here is a simple test case of this issue:
printf "TESTTEST\xC0TESTTEST"|symbolize.py
Since in most cases we don't control application's output, it's
better making the code resilient to those characters.
Test: Ran the above test case and verified no more crashes.
Change-Id: I82929ea11223b97e67862188b23157825ce38549
diff --git a/lib/asan/scripts/symbolize.py b/lib/asan/scripts/symbolize.py
index e385070..ebd97a5 100755
--- a/lib/asan/scripts/symbolize.py
+++ b/lib/asan/scripts/symbolize.py
@@ -101,5 +101,5 @@
paths_to_cut = [os.getcwd() + '/', os.environ['ANDROID_BUILD_TOP'] + '/'] + sys.argv[1:]
for line in sys.stdin:
- line = line.decode('utf-8')
+ line = line.decode('utf-8', 'replace')
symbolize_addr2line(line, binary_prefix, paths_to_cut)