summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorsth <sth.dev@tejp.de>2019-03-20 19:49:39 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-03-20 19:49:39 (GMT)
commitaa3ecb80416958eb6fe8cc1b0dfbbfdfbcccead1 (patch)
treeb721a2dbf84b8f8da54eb804e321a2a25f7d18ea /Modules
parentc1e2c288f41cdc1c6e6e09d9a5277a58232ceb03 (diff)
downloadcpython-aa3ecb80416958eb6fe8cc1b0dfbbfdfbcccead1.zip
cpython-aa3ecb80416958eb6fe8cc1b0dfbbfdfbcccead1.tar.gz
cpython-aa3ecb80416958eb6fe8cc1b0dfbbfdfbcccead1.tar.bz2
bpo-36285: Fix integer overflow in the array module. (GH-12317)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/arraymodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index a5ba27c..4be3beb 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -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;