Skip to content
Permalink
Browse files
gh-97728: Argument Clinic: Fix uninitialized variable in the Py_UNICO…
…DE converter (GH-97729)

It affects function os.system() on Windows and Windows-specific modules
winreg, _winapi, _overlapped, and _msi.
  • Loading branch information
serhiy-storchaka committed Oct 3, 2022
1 parent e738b51 commit 0ee9619a4cba58730c45e65d22288fadbf7680de
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 42 deletions.
@@ -1803,12 +1803,12 @@ static PyObject *
test_Py_UNICODE_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
const Py_UNICODE *a;
const Py_UNICODE *b;
const Py_UNICODE *c;
const Py_UNICODE *d;
const Py_UNICODE *a = NULL;
const Py_UNICODE *b = NULL;
const Py_UNICODE *c = NULL;
const Py_UNICODE *d = NULL;
Py_ssize_t d_length;
const Py_UNICODE *e;
const Py_UNICODE *e = NULL;
Py_ssize_t e_length;

if (!_PyArg_ParseStack(args, nargs, "O&O&O&u#Z#:test_Py_UNICODE_converter",
@@ -1833,7 +1833,7 @@ test_Py_UNICODE_converter_impl(PyObject *module, const Py_UNICODE *a,
const Py_UNICODE *b, const Py_UNICODE *c,
const Py_UNICODE *d, Py_ssize_t d_length,
const Py_UNICODE *e, Py_ssize_t e_length)
/*[clinic end generated code: output=4d426808cdbb3ea3 input=064a3b68ad7f04b0]*/
/*[clinic end generated code: output=9f34a249b3071fdd input=064a3b68ad7f04b0]*/


/*[clinic input]
@@ -0,0 +1,3 @@
Fix possible crashes caused by the use of uninitialized variables when pass
invalid arguments in :func:`os.system` on Windows and in Windows-specific
modules (like ``winreg``).

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -3586,6 +3586,7 @@ def converter_init(self, *, accept={str}, zeroes=False):
self.converter = '_PyUnicode_WideCharString_Opt_Converter'
else:
fail("Py_UNICODE_converter: illegal 'accept' argument " + repr(accept))
self.c_default = "NULL"

def cleanup(self):
if not self.length:

0 comments on commit 0ee9619

Please sign in to comment.