File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11import pickle
2+ from io import BytesIO
23
34from fickling .analysis import Severity , check_safety
45from fickling .exception import UnsafeFileError
@@ -57,17 +58,15 @@ def loads(
5758 Raises:
5859 UnsafeFileError: If the pickle data is unsafe or contains invalid opcodes
5960 """
60- import io
61-
6261 # Convert bytes to file-like object
63- file = io . BytesIO (data )
62+ file = BytesIO (data )
6463
6564 # Reuse existing load() function which already handles all the logic
6665 return load (
6766 file ,
67+ * args ,
6868 max_acceptable_severity = max_acceptable_severity ,
6969 print_results = print_results ,
7070 json_output_path = json_output_path ,
71- * args ,
72- ** kwargs
71+ ** kwargs ,
7372 )
Original file line number Diff line number Diff line change 88
99class Payload :
1010 """Malicious payload for testing"""
11+
1112 def __init__ (self ):
1213 self .a = 1
1314
@@ -50,7 +51,7 @@ def test_loads_matches_pickle_signature(self):
5051 data = pickle .dumps (test_data , protocol = 2 )
5152
5253 # Should work with extra args like pickle.loads()
53- loaded_data = fickling .loads (data , encoding = ' ASCII' , errors = ' strict' )
54+ loaded_data = fickling .loads (data , encoding = " ASCII" , errors = " strict" )
5455
5556 self .assertEqual (loaded_data , test_data )
5657
You can’t perform that action at this time.
0 commit comments