In addition, long_pow() skipped a necessary (albeit extremely unlikely
to trigger) error check when converting an int modulus to long.
Alas, I was unable to write a test case that crashed due to either
cause.
Bugfix candidate.
Core and builtins
-----------------
+- SF bug #1238681: freed pointer is used in longobject.c:long_pow().
+
- SF bug #1229429: PyObject_CallMethod failed to decrement some
reference counts in some error exit cases.
c = (PyLongObject *)x;
Py_INCREF(x);
}
- else if (PyInt_Check(x))
+ else if (PyInt_Check(x)) {
c = (PyLongObject *)PyLong_FromLong(PyInt_AS_LONG(x));
+ if (c == NULL)
+ goto Error;
+ }
else if (x == Py_None)
c = NULL;
else {
}
/* fall through */
Done:
- Py_XDECREF(a);
- Py_XDECREF(b);
- Py_XDECREF(c);
- Py_XDECREF(temp);
if (b->ob_size > FIVEARY_CUTOFF) {
for (i = 0; i < 32; ++i)
Py_XDECREF(table[i]);
}
+ Py_DECREF(a);
+ Py_DECREF(b);
+ Py_XDECREF(c);
+ Py_XDECREF(temp);
return (PyObject *)z;
}