mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-36285: Fix integer overflow in the array module. (GH-12317)
This commit is contained in:
parent
c1e2c288f4
commit
aa3ecb8041
3 changed files with 146 additions and 4 deletions
|
@ -1174,7 +1174,7 @@ static PyObject *
|
|||
array_array_remove(arrayobject *self, PyObject *v)
|
||||
/*[clinic end generated code: output=bef06be9fdf9dceb input=0b1e5aed25590027]*/
|
||||
{
|
||||
int i;
|
||||
Py_ssize_t i;
|
||||
|
||||
for (i = 0; i < Py_SIZE(self); i++) {
|
||||
PyObject *selfi;
|
||||
|
@ -2029,7 +2029,7 @@ array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
|
|||
switch (mformat_code) {
|
||||
case IEEE_754_FLOAT_LE:
|
||||
case IEEE_754_FLOAT_BE: {
|
||||
int i;
|
||||
Py_ssize_t i;
|
||||
int le = (mformat_code == IEEE_754_FLOAT_LE) ? 1 : 0;
|
||||
Py_ssize_t itemcount = Py_SIZE(items) / 4;
|
||||
const unsigned char *memstr =
|
||||
|
@ -2051,7 +2051,7 @@ array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
|
|||
}
|
||||
case IEEE_754_DOUBLE_LE:
|
||||
case IEEE_754_DOUBLE_BE: {
|
||||
int i;
|
||||
Py_ssize_t i;
|
||||
int le = (mformat_code == IEEE_754_DOUBLE_LE) ? 1 : 0;
|
||||
Py_ssize_t itemcount = Py_SIZE(items) / 8;
|
||||
const unsigned char *memstr =
|
||||
|
@ -2106,7 +2106,7 @@ array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
|
|||
case UNSIGNED_INT64_BE:
|
||||
case SIGNED_INT64_LE:
|
||||
case SIGNED_INT64_BE: {
|
||||
int i;
|
||||
Py_ssize_t i;
|
||||
const struct mformatdescr mf_descr =
|
||||
mformat_descriptors[mformat_code];
|
||||
Py_ssize_t itemcount = Py_SIZE(items) / mf_descr.size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue