summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-03-15 02:47:23 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-03-15 02:47:23 (GMT)
commit041c38a790cb9ce14742765e3314d90a7c601809 (patch)
treee6fc9fef94ba56f87ea785a980dd91376028c228 /Objects
parente5cb836d4c481ad8ec6f5e0b611f7162c30a8abb (diff)
downloadcpython-041c38a790cb9ce14742765e3314d90a7c601809.zip
cpython-041c38a790cb9ce14742765e3314d90a7c601809.tar.gz
cpython-041c38a790cb9ce14742765e3314d90a7c601809.tar.bz2
don't do pointer arithmetic with signed numbers
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 4ae22ef..e2d95ae 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -36,7 +36,8 @@ Py_ssize_t quick_int_allocs, quick_neg_int_allocs;
static PyObject *
get_small_int(sdigit ival)
{
- PyObject *v = (PyObject*)(small_ints + ival + NSMALLNEGINTS);
+ assert(-NSMALLNEGINTS <= ival && ival < NSMALLPOSINTS);
+ PyObject *v = (PyObject *)&small_ints[ival + NSMALLNEGINTS];
Py_INCREF(v);
#ifdef COUNT_ALLOCS
if (ival >= 0)