summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-02-10 21:28:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-02-10 21:28:33 (GMT)
commita7b5e82ff03a25c35ea0e0b124a7d113ffa0cb3a (patch)
tree8e765a1c3364f6fbc19cf1f5fc1e1f58a736ef36
parentc2d020090b324285bf144f29ac4da3771be7c40a (diff)
parentb4621899212f5f661ef5c25cd0b71f8b1ab39028 (diff)
downloadcpython-a7b5e82ff03a25c35ea0e0b124a7d113ffa0cb3a.zip
cpython-a7b5e82ff03a25c35ea0e0b124a7d113ffa0cb3a.tar.gz
cpython-a7b5e82ff03a25c35ea0e0b124a7d113ffa0cb3a.tar.bz2
Reject float as uid or gid.
A regression was introduced in the commit for issue #4591.
-rw-r--r--Modules/posixmodule.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2d31c94..0586da3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -406,7 +406,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) {
@@ -454,7 +460,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) {