commit | 041c38a790cb9ce14742765e3314d90a7c601809 | [log] [tgz] |
---|---|---|
author | Benjamin Peterson <benjamin@python.org> | Fri Mar 14 21:47:23 2014 -0500 |
committer | Benjamin Peterson <benjamin@python.org> | Fri Mar 14 21:47:23 2014 -0500 |
tree | e6fc9fef94ba56f87ea785a980dd91376028c228 | |
parent | e5cb836d4c481ad8ec6f5e0b611f7162c30a8abb [diff] |
don't do pointer arithmetic with signed numbers
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 @@ 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)