Skip to content

Commit 22893f3

Browse files
pickle: validate slotstate type in load_build
1 parent 6665115 commit 22893f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/pickle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,8 +1876,10 @@ def load_build(self):
18761876
inst_dict[intern(k)] = v
18771877
else:
18781878
inst_dict[k] = v
1879-
if slotstate:
1880-
for k, v in slotstate.items():
1879+
if slotstate is not None:
1880+
if not isinstance(slotstate, dict):
1881+
raise UnpicklingError("slot state is not a dictionary")
1882+
for k, v in slotstate.items():
18811883
setattr(inst, k, v)
18821884
dispatch[BUILD[0]] = load_build
18831885

0 commit comments

Comments
 (0)