8000 gh-135241: Changed the opcode of _pickle module to look for 00 and 01 specifically by Legoclones · Pull Request #135242 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135241: Changed the opcode of _pickle module to look for 00 and 01 specifically #135242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Changed the opcode of _pickle module to look for 00 and 01 specifically
The python pickle module looks for "00" and "01" but _pickle only looked for 2 characters that parsed to 0 or 1, meaning some payloads like "+0" or " 0" would lead to different results in different implementations
  • Loading branch information
Legoclones committed Jun 8, 2025
commit 21ff2115a2dc3af8579efdfc270b1e3e8e2a44e3
2 changes: 1 addition & 1 deletion Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -5255,7 +5255,7 @@ load_int(PickleState *state, UnpicklerObject *self)
}
}
else {
if (len == 3 && (x == 0 || x == 1)) {
if (len == 3 && s[0] == '0' && (s[1] == '0' || s[1] == '1')) {
if ((value = PyBool_FromLong(x)) == NULL)
return -1;
}
Expand Down
Loading
0