GeezerVison is showing github.com — bpo-42036:Fixed unchecked return in Modules/posixmodule.c by monocle-ai · Pull Request #22696 · python/cpython
Conversation
monocle-ai
commented
Oct 14, 2020
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
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:
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:
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:
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:
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) {
https://bugs.python.org/issue42036
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
**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 username
We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:
@monocle-ai
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!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing this stale PR because the CLA is still not signed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|