Skip to content

Commit

Permalink
Safer detection
Browse files Browse the repository at this point in the history
  • Loading branch information
TLCFEM committed May 31, 2024
1 parent 9baaebc commit 51ba03e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/msglc/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ def _child(self, toc: dict | int):
# {"p": [start_pos, end_pos]}
# this is used in small objects
if 2 == len(child_pos := toc["p"]) and all(isinstance(x, int) for x in child_pos):
if isinstance(data := self._read(*child_pos), bytes) and data.startswith(
b"\x80\x02cnumpy.core.multiarray"
):
if isinstance(data := self._read(*child_pos), bytes) and b"numpy.core.multiarray" in data[:40]:
return pickle.loads(data)
return data

Expand Down

0 comments on commit 51ba03e

Please sign in to comment.