From f1995d3c6bf1a1ed756b100042f389bde3c701e5 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 5dd59410..fb33fe8f 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -699,7 +699,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) @@ -709,7 +709,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient) except EOFError: pass except pickle.UnpicklingError: - callback(b.decode("ascii")) + callback(b.decode("ascii", errors="replace")) return unpickler