diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:50 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:50 -0800 |
commit | 3b0e4320092ac0504b6670cafaf0301b908c91fc (patch) | |
tree | d3be1b6b844d61763bb366fa21ceed475e5703fd /Python/clinic/import.c.h | |
parent | b2fa705fd3887c326e811c418469c784353027f4 (diff) | |
parent | f687fbcd73c14dfcbe086eb5cd94b298f1e81e72 (diff) | |
download | cpython-3b0e4320092ac0504b6670cafaf0301b908c91fc.tar.gz |
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Python/clinic/import.c.h')
-rw-r--r-- | Python/clinic/import.c.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h index b3460b061d..0165b7c4e1 100644 --- a/Python/clinic/import.c.h +++ b/Python/clinic/import.c.h @@ -75,23 +75,27 @@ PyDoc_STRVAR(_imp__fix_co_filename__doc__, " File path to use."); #define _IMP__FIX_CO_FILENAME_METHODDEF \ - {"_fix_co_filename", (PyCFunction)_imp__fix_co_filename, METH_VARARGS, _imp__fix_co_filename__doc__}, + {"_fix_co_filename", (PyCFunction)_imp__fix_co_filename, METH_FASTCALL, _imp__fix_co_filename__doc__}, static PyObject * _imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code, PyObject *path); static PyObject * -_imp__fix_co_filename(PyObject *module, PyObject *args) +_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyCodeObject *code; PyObject *path; - if (!PyArg_ParseTuple(args, "O!U:_fix_co_filename", + if (!_PyArg_ParseStack(args, nargs, "O!U:_fix_co_filename", &PyCode_Type, &code, &path)) { goto exit; } + + if (!_PyArg_NoStackKeywords("_fix_co_filename", kwnames)) { + goto exit; + } return_value = _imp__fix_co_filename_impl(module, code, path); exit: @@ -269,23 +273,27 @@ PyDoc_STRVAR(_imp_create_dynamic__doc__, "Create an extension module."); #define _IMP_CREATE_DYNAMIC_METHODDEF \ - {"create_dynamic", (PyCFunction)_imp_create_dynamic, METH_VARARGS, _imp_create_dynamic__doc__}, + {"create_dynamic", (PyCFunction)_imp_create_dynamic, METH_FASTCALL, _imp_create_dynamic__doc__}, static PyObject * _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file); static PyObject * -_imp_create_dynamic(PyObject *module, PyObject *args) +_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *spec; PyObject *file = NULL; - if (!PyArg_UnpackTuple(args, "create_dynamic", + if (!_PyArg_UnpackStack(args, nargs, "create_dynamic", 1, 2, &spec, &file)) { goto exit; } + + if (!_PyArg_NoStackKeywords("create_dynamic", kwnames)) { + goto exit; + } return_value = _imp_create_dynamic_impl(module, spec, file); exit: @@ -361,4 +369,4 @@ exit: #ifndef _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=d24d7f73702a907f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c1d0e65d04114958 input=a9049054013a1b77]*/ |