Kaydet (Commit) b4621899 authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Reject float as uid or gid.

A regression was introduced in the commit for issue issue #4591.
üst 7cf55993
......@@ -437,7 +437,13 @@ int
_Py_Uid_Converter(PyObject *obj, void *p)
{
int overflow;
long result = PyLong_AsLongAndOverflow(obj, &overflow);
long result;
if (PyFloat_Check(obj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float");
return 0;
}
result = PyLong_AsLongAndOverflow(obj, &overflow);
if (overflow < 0)
goto OverflowDown;
if (!overflow && result == -1) {
......@@ -485,7 +491,13 @@ int
_Py_Gid_Converter(PyObject *obj, void *p)
{
int overflow;
long result = PyLong_AsLongAndOverflow(obj, &overflow);
long result;
if (PyFloat_Check(obj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float");
return 0;
}
result = PyLong_AsLongAndOverflow(obj, &overflow);
if (overflow < 0)
goto OverflowDown;
if (!overflow && result == -1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment