-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-42036:Fixed unchecked return in Modules/posixmodule.c #22696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
**Instance 1** File : `Modules/posixmodule.c` Enclosing Function : `os_times_impl` Function : `GetProcessTimes@20` https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/posixmodule.c#L8505 **Issue in**: _user, kernel_ **Code extract**: ```cpp FILETIME create, exit, kernel, user; HANDLE hProc; hProc = GetCurrentProcess(); GetProcessTimes(hProc, &create, &exit, &kernel, &user); <------ HERE /* The fields of a FILETIME structure are the hi and lo part of a 64-bit value expressed in 100 nanosecond units. ``` **How can I fix it?** Correct reference usage found in `Modules/timemodule.c` at line `1133`. https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/timemodule.c#L1133 **Code extract**: ```cpp BOOL ok; process = GetCurrentProcess(); ok = GetProcessTimes(process, &creation_time, &exit_time, <------ HERE &kernel_time, &user_time); if (!ok) { ``` --- **Instance 2** File : `Modules/posixmodule.c` Enclosing Function : `posixmodule_exec` Function : `dir_fd_converter` https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/posixmodule.c#L15060 **Issue in**: _ignored_ **Code extract**: ```cpp fd_specified("", -1); follow_symlinks_specified("", 1); dir_fd_and_follow_symlinks_invalid("chmod", DEFAULT_DIR_FD, 1); dir_fd_converter(Py_None, &ignored); <------ HERE dir_fd_unavailable(Py_None, &ignored); } ``` **How can I fix it?** Correct reference usage found in `Modules/posixmodule.c` at line `1258`. https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/posixmodule.c#L1258 **Code extract**: ```cpp dir_fd_unavailable(PyObject *o, void *p) { int dir_fd; if (!dir_fd_converter(o, &dir_fd)) <------ HERE return 0; if (dir_fd != DEFAULT_DIR_FD) { ```
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). Recognized GitHub usernameWe couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames: This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
This PR is stale because it has been open for 30 days with no activity. |
@@ -15022,7 +15027,10 @@ posixmodule_exec(PyObject *m) | |||
fd_specified("", -1); | |||
follow_symlinks_specified("", 1); | |||
dir_fd_and_follow_symlinks_invalid("chmod", DEFAULT_DIR_FD, 1); | |||
dir_fd_converter(Py_None, &ignored); | |||
if(!dir_fd_converter(Py_None, &ignored)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It never fails.
ok = GetProcessTimes(hProc, &create, &exit, &kernel, &user); | ||
if (!ok) { | ||
PyErr_SetFromWindowsErr(0); | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not even compiled.
return -1; | |
return NULL; |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
This PR is stale because it has been open for 30 days with no activity. If the CLA is not signed within 14 days, it will be closed. See also https://devguide.python.org/pullrequest/#licensing |
Closing this stale PR because the CLA is still not signed. |
Instance 1
File :
Modules/posixmodule.c
Enclosing Function :
os_times_impl
Function :
GetProcessTimes@20
https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/posixmodule.c#L8505
Issue in: user, kernel
Code extract:
How can I fix it?
Correct reference usage found in
Modules/timemodule.c
at line1133
.https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/timemodule.c#L1133
Code extract:
BOOL ok; process = GetCurrentProcess(); ok = GetProcessTimes(process, &creation_time, &exit_time, <------ HERE &kernel_time, &user_time); if (!ok) {
Instance 2
File :
Modules/posixmodule.c
Enclosing Function :
posixmodule_exec
Function :
dir_fd_converter
https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/posixmodule.c#L15060
Issue in: ignored
Code extract:
How can I fix it?
Correct reference usage found in
Modules/posixmodule.c
at line1258
.https://github.com/siva-msft/cpython/blob/582aaf19e8b94a70c1f96792197770d604ba0fdf/Modules/posixmodule.c#L1258
Code extract:
https://bugs.python.org/issue42036