changeset: 90541:62438d1b11c7 user: Victor Stinner date: Fri May 02 23:26:03 2014 +0200 files: Objects/obmalloc.c description: Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going to redirect. diff -r 5b0fda8f5718 -r 62438d1b11c7 Objects/obmalloc.c --- a/Objects/obmalloc.c Fri May 02 22:31:14 2014 +0200 +++ b/Objects/obmalloc.c Fri May 02 23:26:03 2014 +0200 @@ -1183,12 +1183,12 @@ goto redirect; #endif + assert(nelem <= PY_SSIZE_T_MAX / elsize); + nbytes = nelem * elsize; + if (nelem == 0 || elsize == 0) goto redirect; - assert(nelem <= PY_SSIZE_T_MAX / elsize); - nbytes = nelem * elsize; - if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) { LOCK(); /*