]> granicus.if.org Git - python/commitdiff
k_mul(): Moved an assert down. In a debug build, interrupting a
authorTim Peters <tim.peters@gmail.com>
Mon, 12 Aug 2002 19:43:49 +0000 (19:43 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 12 Aug 2002 19:43:49 +0000 (19:43 +0000)
multiply via Ctrl+C could cause a NULL-pointer dereference due to
the assert.

Objects/longobject.c

index 95e32ce8f6c6c2ac24dfd086dfe96277957ee3c0..8c9f69a5671cdd6386e3b5c27bfc11a6739c237e 100644 (file)
@@ -1722,14 +1722,14 @@ k_mul(PyLongObject *a, PyLongObject *b)
        bh = bl = NULL;
 
        t3 = k_mul(t1, t2);
-       assert(t3->ob_size >= 0);
        Py_DECREF(t1);
        Py_DECREF(t2);
        if (t3 == NULL) goto fail;
+       assert(t3->ob_size >= 0);
 
        /* Add t3.  Caution:  t3 can spill one bit beyond the allocated
         * result space; it's t3-al*bl-ah*bh that always fits.  We have
-        * to arrange to ignore the hight bit.
+        * to arrange to ignore the high bit.
         */
        if (t3->ob_size > i) {
                assert(t3->ob_size == i+1);     /* just one digit over */