From 68c31c45d6a1d706bb7b14d7a68d003e27ec7f29 Mon Sep 17 00:00:00 2001 From: WildCard65 Date: Tue, 23 Jun 2020 07:36:00 -0400 Subject: [PATCH 1/2] BPO-41085: Fixed 'array.array.index' downcasting 'Py_ssize_t' to 'long'. --- Modules/arraymodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 8f12c616463356..2d498c7e829415 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1130,7 +1130,7 @@ array_array_index(arrayobject *self, PyObject *v) cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); Py_DECREF(selfi); if (cmp > 0) { - return PyLong_FromLong((long)i); + return PyLong_FromSsize_t(i); } else if (cmp < 0) return NULL; From 43fc44921ec9636b473ca92adb8cd520b760dc5e Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:02:46 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst diff --git a/Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst b/Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst new file mode 100644 index 00000000000000..463dffdd653eeb --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst @@ -0,0 +1,2 @@ +Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows +for index larger than ``2**31``.