diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-10 23:28:02 +0200 | 
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-10 23:28:02 +0200 | 
| commit | b4621899212f5f661ef5c25cd0b71f8b1ab39028 (patch) | |
| tree | 780a4d6df457adf8a4acb7588c6eed62a5ecf55e /Modules/posixmodule.c | |
| parent | 7cf5599346e397c3489012ad818b4f9b5d572b89 (diff) | |
| download | cpython-git-b4621899212f5f661ef5c25cd0b71f8b1ab39028.tar.gz | |
Reject float as uid or gid.
A regression was introduced in the commit for issue issue #4591.
Diffstat (limited to 'Modules/posixmodule.c')
| -rw-r--r-- | Modules/posixmodule.c | 16 | 
1 files changed, 14 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 7e36df5da6..91352d4d4c 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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) {  | 
