Skip to content

potential nullptr dereference + use of uninitialized memory in fileutils #102281

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

Closed
maxbachmann opened this issue Feb 26, 2023 · 3 comments
Closed
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@maxbachmann
Copy link
Contributor

maxbachmann commented Feb 26, 2023

Bug report

cpython/Python/fileutils.c

Lines 2161 to 2162 in 6daf42b

join_relfile(filename, bufsize, dirname, relfile);
return filename;
can lead to use of uninitialized memory when join_relfile fails.

cpython/Python/fileutils.c

Lines 2197 to 2199 in 6daf42b

_Py_normpath(wchar_t *path, Py_ssize_t size)
{
if (!path[0] || size == 0) {
in combination with
path2 = _Py_normpath(_Py_join_relfile(path, resolved), -1);

leads to a nullptr dereference.

Linked PRs

@maxbachmann maxbachmann added the type-bug An unexpected behavior, bug, or error label Feb 26, 2023
@arhadthedev arhadthedev added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Mar 4, 2023
@hauntsaninja
Copy link
Contributor

Thanks for the fix! Looks like this could still use backports

@maxbachmann
Copy link
Contributor Author

Thanks for the reminder

hauntsaninja pushed a commit that referenced this issue Mar 25, 2023
#103040)

[3.11] gh-102281: Fix potential nullptr dereference + use of uninitialized memory (gh-102282)
(cherry picked from commit afa6092)
@hauntsaninja
Copy link
Contributor

Thanks again :-)

Fidget-Spinner pushed a commit to Fidget-Spinner/cpython that referenced this issue Mar 27, 2023
warsaw pushed a commit to warsaw/cpython that referenced this issue Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants