From 6ca8714fdd72dd121a48664917a94b82876fb428 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 18 Sep 2023 23:39:02 +0200 Subject: [PATCH] handle potentially invalid ascii characters --- owrx/dsp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owrx/dsp.py b/owrx/dsp.py index 3d77c27f..8860b9b1 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -702,7 +702,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient) b = data.tobytes() # If we know it's not pickled, let us not unpickle if len(b) < 2 or b[0] != 0x80 or not 3 <= b[1] <= pickle.HIGHEST_PROTOCOL: - callback(b.decode("ascii")) + callback(b.decode("ascii", errors="replace")) return io = BytesIO(b) @@ -712,7 +712,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient) except EOFError: pass except pickle.UnpicklingError: - callback(b.decode("ascii")) + callback(b.decode("ascii", errors="replace")) return unpickler