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",
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]
--- /dev/null
+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``).
DWORD protect;
DWORD max_size_high;
DWORD max_size_low;
- LPCWSTR name;
+ LPCWSTR name = NULL;
HANDLE _return_value;
if (!_PyArg_ParseStack(args, nargs, "" F_HANDLE "" F_POINTER "kkkO&:CreateFileMapping",
_winapi_CreateJunction(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- LPCWSTR src_path;
- LPCWSTR dst_path;
+ LPCWSTR src_path = NULL;
+ LPCWSTR dst_path = NULL;
if (!_PyArg_CheckPositional("CreateJunction", nargs, 2, 2)) {
goto exit;
_winapi_CreateProcess(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- const Py_UNICODE *application_name;
+ const Py_UNICODE *application_name = NULL;
PyObject *command_line;
PyObject *proc_attrs;
PyObject *thread_attrs;
BOOL inherit_handles;
DWORD creation_flags;
PyObject *env_mapping;
- const Py_UNICODE *current_directory;
+ const Py_UNICODE *current_directory = NULL;
PyObject *startup_info;
if (!_PyArg_ParseStack(args, nargs, "O&OOOikOO&O:CreateProcess",
PyObject *return_value = NULL;
DWORD desired_access;
BOOL inherit_handle;
- LPCWSTR name;
+ LPCWSTR name = NULL;
HANDLE _return_value;
if (!_PyArg_ParseStack(args, nargs, "kiO&:OpenFileMapping",
.kwtuple = KWTUPLE,
};
#undef KWTUPLE
- LPCWSTR locale;
+ LPCWSTR locale = NULL;
DWORD flags;
- LPCWSTR src;
+ LPCWSTR src = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
_PyUnicode_WideCharString_Converter, &locale, &flags, _PyUnicode_WideCharString_Converter, &src)) {
exit:
return return_value;
}
-/*[clinic end generated code: output=3e51e0b2ea3fea5a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=83c4a3f0e70e7775 input=a9049054013a1b77]*/
PyObject *EventAttributes;
BOOL ManualReset;
BOOL InitialState;
- const Py_UNICODE *Name;
+ const Py_UNICODE *Name = NULL;
if (!_PyArg_CheckPositional("CreateEvent", nargs, 4, 4)) {
goto exit;
_overlapped_Overlapped_ConnectPipe(OverlappedObject *self, PyObject *arg)
{
PyObject *return_value = NULL;
- const Py_UNICODE *Address;
+ const Py_UNICODE *Address = NULL;
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("ConnectPipe", "argument", "str", arg);
return return_value;
}
-/*[clinic end generated code: output=ed7ca699b5cf6260 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e0f866222bd5873b input=a9049054013a1b77]*/
};
#undef KWTUPLE
PyObject *argsbuf[1];
- const Py_UNICODE *command;
+ const Py_UNICODE *command = NULL;
long _return_value;
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=dc71eece3fc988a7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dd43d388b442c96d input=a9049054013a1b77]*/
{
PyObject *return_value = NULL;
int field;
- const Py_UNICODE *value;
+ const Py_UNICODE *value = NULL;
if (!_PyArg_CheckPositional("SetString", nargs, 2, 2)) {
goto exit;
{
PyObject *return_value = NULL;
int field;
- const Py_UNICODE *value;
+ const Py_UNICODE *value = NULL;
if (!_PyArg_CheckPositional("SetStream", nargs, 2, 2)) {
goto exit;
_msi_Database_OpenView(msiobj *self, PyObject *arg)
{
PyObject *return_value = NULL;
- const Py_UNICODE *sql;
+ const Py_UNICODE *sql = NULL;
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("OpenView", "argument", "str", arg);
_msi_OpenDatabase(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- const Py_UNICODE *path;
+ const Py_UNICODE *path = NULL;
int persist;
if (!_PyArg_CheckPositional("OpenDatabase", nargs, 2, 2)) {
exit:
return return_value;
}
-/*[clinic end generated code: output=583505220fadb52b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7d083c61679eed83 input=a9049054013a1b77]*/
winreg_ConnectRegistry(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- const Py_UNICODE *computer_name;
+ const Py_UNICODE *computer_name = NULL;
HKEY key;
HKEY _return_value;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
HKEY _return_value;
if (!_PyArg_CheckPositional("CreateKey", nargs, 2, 2)) {
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
int reserved = 0;
REGSAM access = KEY_WRITE;
HKEY _return_value;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
if (!_PyArg_CheckPositional("DeleteKey", nargs, 2, 2)) {
goto exit;
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
REGSAM access = KEY_WOW64_64KEY;
int reserved = 0;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *value;
+ const Py_UNICODE *value = NULL;
if (!_PyArg_CheckPositional("DeleteValue", nargs, 2, 2)) {
goto exit;
winreg_ExpandEnvironmentStrings(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
- const Py_UNICODE *string;
+ const Py_UNICODE *string = NULL;
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("ExpandEnvironmentStrings", "argument", "str", arg);
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *sub_key;
- const Py_UNICODE *file_name;
+ const Py_UNICODE *sub_key = NULL;
+ const Py_UNICODE *file_name = NULL;
if (!_PyArg_CheckPositional("LoadKey", nargs, 3, 3)) {
goto exit;
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
int reserved = 0;
REGSAM access = KEY_READ;
HKEY _return_value;
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
int reserved = 0;
REGSAM access = KEY_READ;
HKEY _return_value;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
if (!_PyArg_CheckPositional("QueryValue", nargs, 2, 2)) {
goto exit;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *name;
+ const Py_UNICODE *name = NULL;
if (!_PyArg_CheckPositional("QueryValueEx", nargs, 2, 2)) {
goto exit;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *file_name;
+ const Py_UNICODE *file_name = NULL;
if (!_PyArg_CheckPositional("SaveKey", nargs, 2, 2)) {
goto exit;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *sub_key;
+ const Py_UNICODE *sub_key = NULL;
DWORD type;
PyObject *value_obj;
{
PyObject *return_value = NULL;
HKEY key;
- const Py_UNICODE *value_name;
+ const Py_UNICODE *value_name = NULL;
PyObject *reserved;
DWORD type;
PyObject *value;
exit:
return return_value;
}
-/*[clinic end generated code: output=5dfd7dbce8ccb392 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7e817dc5edc914d3 input=a9049054013a1b77]*/
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: