Commit af8fc645 authored by Victor Stinner's avatar Victor Stinner

Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going to

redirect.
parent db067af1
...@@ -1183,12 +1183,12 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) ...@@ -1183,12 +1183,12 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
goto redirect; goto redirect;
#endif #endif
if (nelem == 0 || elsize == 0)
goto redirect;
assert(nelem <= PY_SSIZE_T_MAX / elsize); assert(nelem <= PY_SSIZE_T_MAX / elsize);
nbytes = nelem * elsize; nbytes = nelem * elsize;
if (nelem == 0 || elsize == 0)
goto redirect;
if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) { if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) {
LOCK(); LOCK();
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment