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:40:21 +01:00
parent 82e60de727
commit bf6ecf92fa
3 changed files with 31 additions and 14 deletions

View file

@ -1579,7 +1579,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;