summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/rangeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 24765f4..5095e52 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -38,10 +38,16 @@ long_mul(long i, long j, long *kk)
if (c == NULL)
return 0;
+ if (!PyInt_Check(c)) {
+ Py_DECREF(c);
+ goto overflow;
+ }
+
*kk = PyInt_AS_LONG(c);
Py_DECREF(c);
if (*kk > INT_MAX) {
+ overflow:
PyErr_SetString(PyExc_OverflowError,
"integer multiplication");
return 0;