Skip to content

gh-135302: Fix NULL pointer dereference in has_kwonlydefaults function #135303

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rialbat
Copy link
Contributor

@rialbat rialbat commented Jun 9, 2025

This PR adds a NULL check for the kw_defaults parameter inside the has_kwonlydefaults function.

Comment on lines +1783 to +1785
if (!kw_defaults) {
return 0;
}
Copy link
Member

@picnixz picnixz Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the loop won't be executed if we pass a NULL because s->v.AsyncFunctionDef.args->kwonlyargs would have a sequence length of 0 (for the existing calls). So I think we should add an assertion instead or leave the code as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants