mirror of
https://github.com/jketterl/openwebrx.git
synced 2025-12-06 07:12:09 +01:00
handle potentially invalid ascii characters
This commit is contained in:
parent
4c2f9a67f6
commit
f1995d3c6b
|
|
@ -699,7 +699,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
|
||||||
b = data.tobytes()
|
b = data.tobytes()
|
||||||
# If we know it's not pickled, let us not unpickle
|
# 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:
|
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
|
return
|
||||||
|
|
||||||
io = BytesIO(b)
|
io = BytesIO(b)
|
||||||
|
|
@ -709,7 +709,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
pass
|
pass
|
||||||
except pickle.UnpicklingError:
|
except pickle.UnpicklingError:
|
||||||
callback(b.decode("ascii"))
|
callback(b.decode("ascii", errors="replace"))
|
||||||
|
|
||||||
return unpickler
|
return unpickler
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue