From 449aa694e8fe9d1a2f30ff57490b3e1718c3fd88 Mon Sep 17 00:00:00 2001 From: Tyson Smith Date: Thu, 4 Jan 2024 18:58:40 -0800 Subject: [PATCH] Sanitize short signature The short signature can contain characters that affect console output. --- grizzly/common/report.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/grizzly/common/report.py b/grizzly/common/report.py index dda93a68..63d78911 100644 --- a/grizzly/common/report.py +++ b/grizzly/common/report.py @@ -434,7 +434,16 @@ def short_signature(self): # FM crash signature creation failed self._short_signature = "Signature creation failed" else: - self._short_signature = self.crash_info.createShortSignature() + # sanitize short signature + # error messages can contain characters that affect console output + # for example: b'\xef\xbf\xbd\xc2\x8dA' + self._short_signature = str( + self.crash_info.createShortSignature().encode( + "utf-8", errors="replace" + ), + "ascii", + errors="backslashreplace", + ) return self._short_signature @staticmethod