]> granicus.if.org Git - python/commitdiff
Fix for SF bug 571885
authorJeremy Hylton <jeremy@alum.mit.edu>
Thu, 20 Jun 2002 23:13:17 +0000 (23:13 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Thu, 20 Jun 2002 23:13:17 +0000 (23:13 +0000)
When resizing a tuple, zero out the memory starting at the end of the
old tuple not at the beginning of the old tuple.

Objects/tupleobject.c

index 525e8f6e63c78b8eee11d01625db24b3885a84c6..4c264fd46ff11c7ab38ebc865c9fab1c44d724e7 100644 (file)
@@ -696,8 +696,8 @@ _PyTuple_Resize(PyObject **pv, int newsize)
        _Py_NewReference((PyObject *) sv);
        /* Zero out items added by growing */
        if (newsize > oldsize)
-               memset(sv->ob_item, 0,
-                       sizeof(*sv->ob_item) * (newsize - oldsize));
+               memset(&sv->ob_item[oldsize], 0,
+                      sizeof(*sv->ob_item) * (newsize - oldsize));
        *pv = (PyObject *) sv;
        _PyObject_GC_TRACK(sv);
        return 0;