Issue #15989: Fixed some scarcely probable integer overflows.

It is very unlikely that they can occur in real code for now.
This commit is contained in:
Serhiy Storchaka 2015-09-06 21:25:30 +03:00
parent 7827a5b7c2
commit 56f6e76c68
7 changed files with 27 additions and 23 deletions

View file

@ -9481,7 +9481,7 @@ os__getdiskusage_impl(PyModuleDef *module, Py_UNICODE *path)
*/
struct constdef {
char *name;
long value;
int value;
};
static int
@ -9489,7 +9489,10 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
size_t tablesize)
{
if (PyLong_Check(arg)) {
*valuep = PyLong_AS_LONG(arg);
int value = _PyLong_AsInt(arg);
if (value == -1 && PyErr_Occurred())
return 0;
*valuep = value;
return 1;
}
else {