diff Modules/arraymodule.c @ 72468:3fb9464f9b02

Issue #1621: Fix undefined behaviour from signed overflow in datetime module hashes, array and list iterations, and get_integer (stringlib/string_format.h)
author Mark Dickinson <mdickinson@enthought.com>
date Sun, 25 Sep 2011 15:34:32 +0100
parents 15659e0e2b2e
children 8beaa9a37387
line wrap: on
line diff
--- a/Modules/arraymodule.c	Sun Sep 25 15:26:43 2011 +0100
+++ b/Modules/arraymodule.c	Sun Sep 25 15:34:32 2011 +0100
@@ -2351,7 +2351,7 @@
                 self->ob_item + (cur + 1) * itemsize,
                 lim * itemsize);
         }
-        cur = start + slicelength * step;
+        cur = start + (size_t)slicelength * step;
         if (cur < (size_t)Py_SIZE(self)) {
             memmove(self->ob_item + (cur-slicelength) * itemsize,
                 self->ob_item + cur * itemsize,