summaryrefslogtreecommitdiff
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2011-09-25 15:34:32 +0100
committerMark Dickinson <mdickinson@enthought.com>2011-09-25 15:34:32 +0100
commitc7d93b761413834e0ac39f5fc648565a2843121f (patch)
tree0bcb66dfcb476fb49a59ce019943f293f003dbc0 /Objects/listobject.c
parent50203a69b344e80be5000fe87aafad09e84cde85 (diff)
downloadcpython-git-c7d93b761413834e0ac39f5fc648565a2843121f.tar.gz
Issue #1621: Fix undefined behaviour from signed overflow in datetime module hashes, array and list iterations, and get_integer (stringlib/string_format.h)
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index cada70857c..1c516e962b 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2434,7 +2434,7 @@ list_subscript(PyListObject* self, PyObject* item)
src = self->ob_item;
dest = ((PyListObject *)result)->ob_item;
for (cur = start, i = 0; i < slicelength;
- cur += step, i++) {
+ cur += (size_t)step, i++) {
it = src[cur];
Py_INCREF(it);
dest[i] = it;
@@ -2525,7 +2525,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
self->ob_item + cur + 1,
lim * sizeof(PyObject *));
}
- cur = start + slicelength*step;
+ cur = start + (size_t)slicelength * step;
if (cur < (size_t)Py_SIZE(self)) {
memmove(self->ob_item + cur - slicelength,
self->ob_item + cur,
@@ -2589,7 +2589,7 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
selfitems = self->ob_item;
seqitems = PySequence_Fast_ITEMS(seq);
for (cur = start, i = 0; i < slicelength;
- cur += step, i++) {
+ cur += (size_t)step, i++) {
garbage[i] = selfitems[cur];
ins = seqitems[i];
Py_INCREF(ins);