mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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:
parent
7827a5b7c2
commit
56f6e76c68
7 changed files with 27 additions and 23 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue