Skip to content
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

C API functions like PyErr_SetFromErrnoWithFilename() can use incorrect error code #107916

Closed
serhiy-storchaka opened this issue Aug 13, 2023 · 0 comments · Fixed by #108205
Closed
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes topic-C-API type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Aug 13, 2023

Calling PyUnicode_DecodeFSDefault() in C API functions PyErr_SetFromErrnoWithFilename(), PyErr_SetExcFromWindowsErrWithFilename() and PyErr_SetFromWindowsErrWithFilename() can modify the value of errno or the result of GetLastError() which are used in these functions.

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.11 only security fixes topic-C-API 3.12 bugs and security fixes 3.13 new features, bugs and security fixes labels Aug 13, 2023
@serhiy-storchaka serhiy-storchaka self-assigned this Aug 13, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Aug 14, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Aug 19, 2023
serhiy-storchaka added a commit that referenced this issue Aug 21, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 21, 2023
…PyErr_SetFromErrnoWithFilename() etc (pythonGH-107929)

(cherry picked from commit 80bdebd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 21, 2023
…PyErr_SetFromErrnoWithFilename() etc (pythonGH-107929)

(cherry picked from commit 80bdebd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Aug 21, 2023
… PyErr_SetFromErrnoWithFilename() etc (GH-107929) (GH-108206)

(cherry picked from commit 80bdebd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Yhg1s pushed a commit that referenced this issue Aug 21, 2023
… PyErr_SetFromErrnoWithFilename() etc (GH-107929) (#108205)

gh-107916: Save the error code before decoding the filename in PyErr_SetFromErrnoWithFilename() etc (GH-107929)
(cherry picked from commit 80bdebd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes topic-C-API type-bug An unexpected behavior, bug, or error
Projects
None yet
1 participant