-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Potential NULL dereference of kw_defaults in has_kwonlydefaults #135302
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
Comments
This isn't necessary because we access kw_defaults only if kwonlyargs is nonempty. |
@JelleZijlstra I suggested adding an assertion #135303 (comment) but I don't know if you wouldn't prefer a PR that adds assertions also elsewhere rather than just modifiying this single place. |
I don't really have a preference. The code is fine as is; an assertion would be harmless but not help much. Feel free to merge a PR adding assertions if you feel it's useful. |
I think it's only useful if there is a chance to call the function by mistake. If it's not the case, then let's keep the code as is (I don't know if there are other places that would benefit having an assertion) |
Got it. Thanks for your answer. I'll close the issue and PR. |
Uh oh!
There was an error while loading. Please reload this page.
The pointer s->v.AsyncFunctionDef.args->kw_defaults is explicitly checked for NULL:
cpython/Python/symtable.c
Lines 2193 to 2195 in aaad2e8
However, a few lines later, the same pointer is passed unconditionally to the has_kwonlydefaults function:
cpython/Python/symtable.c
Lines 2203 to 2204 in aaad2e8
Inside has_kwonlydefaults, the kw_defaults parameter is not checked for NULL before being dereferenced:
cpython/Python/symtable.c
Lines 1783 to 1787 in aaad2e8
Linked PRs
The text was updated successfully, but these errors were encountered: