From f4daed1b1b4d5020d648ac2ea135068097e752c8 Mon Sep 17 00:00:00 2001 From: Xuan Xing Date: Tue, 17 Sep 2019 12:13:20 -0700 Subject: 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 --- lib/asan/scripts/symbolize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/asan/scripts/symbolize.py b/lib/asan/scripts/symbolize.py index e38507023..ebd97a567 100755 --- a/lib/asan/scripts/symbolize.py +++ b/lib/asan/scripts/symbolize.py @@ -101,5 +101,5 @@ binary_prefix = os.path.join(os.environ['ANDROID_PRODUCT_OUT'], 'symbols') 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) -- cgit v1.2.3