diff options
author | Xuan Xing <xuanxing@google.com> | 2019-09-17 12:13:20 -0700 |
---|---|---|
committer | Xuan Xing <xuanxing@google.com> | 2019-09-17 12:13:20 -0700 |
commit | f4daed1b1b4d5020d648ac2ea135068097e752c8 (patch) | |
tree | cc543caaba450076d4d2e09f7f51122a7a5f0155 | |
parent | b0c3d33c82bf84cceea95b828476f42a82b9c248 (diff) | |
download | compiler-rt-f4daed1b1b4d5020d648ac2ea135068097e752c8.tar.gz |
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
-rwxr-xr-x | lib/asan/scripts/symbolize.py | 2 |
1 files changed, 1 insertions, 1 deletions
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) |