Skip to content

Commit 21ff211

Browse files
committed
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
1 parent 8fdbbf8 commit 21ff211

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/_pickle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5255,7 +5255,7 @@ load_int(PickleState *state, UnpicklerObject *self)
52555255
}
52565256
}
52575257
else {
5258-
if (len == 3 && (x == 0 || x == 1)) {
5258+
if (len == 3 && s[0] == '0' && (s[1] == '0' || s[1] == '1')) {
52595259
if ((value = PyBool_FromLong(x)) == NULL)
52605260
return -1;
52615261
}

0 commit comments

Comments
 (0)