Skip to content

cursesmodule uses winobj which might be NULL #123913

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
sobolevn opened this issue Sep 10, 2024 · 1 comment
Closed

cursesmodule uses winobj which might be NULL #123913

sobolevn opened this issue Sep 10, 2024 · 1 comment
Assignees
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Sep 10, 2024

Bug report

Here's the problematic code:

winobj = (PyCursesWindowObject *)PyCursesWindow_New(win, NULL);
screen_encoding = winobj->encoding;
return (PyObject *)winobj;

Why is it problematic? Because PyCursesWindow_New can return NULL here:

if (wo->encoding == NULL) {
Py_DECREF(wo);
PyErr_NoMemory();
return NULL;
}

So, winobj->encoding of NULL is not good :(

I will send a PR.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error extension-modules C modules in the Modules dir labels Sep 10, 2024
@sobolevn sobolevn self-assigned this Sep 10, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Sep 10, 2024
@sobolevn
Copy link
Member Author

Will be solved in #123910
Closing as a duplicate.

@sobolevn sobolevn closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant