Issue #12848: The pure Python pickle implementation now treats object lengths as unsigned 32-bit integers, like the C implementation does.

Patch by Serhiy Storchaka.
This commit is contained in:
Antoine Pitrou 2012-11-24 20:41:34 +01:00
commit 9982c53c2f
3 changed files with 31 additions and 14 deletions

View file

@ -1589,7 +1589,7 @@ save_long(PicklerObject *self, PyObject *obj)
* byte at the start, and cut it back later if possible.
*/
nbytes = (nbits >> 3) + 1;
if (nbytes > INT_MAX) {
if (nbytes > 0x7fffffffL) {
PyErr_SetString(PyExc_OverflowError,
"long too large to pickle");
goto error;