Skip to content

Argument Clinic does not check for errors in PyBuffer_FillInfo in generated code #115026

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 Feb 5, 2024 · 2 comments
Closed
Assignees
Labels
extension-modules C modules in the Modules dir topic-argument-clinic type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Feb 5, 2024

Bug report

AC generates:

However, PyBuffer_FillInfo can raise errors and return -1 on multiple occasions, so it is not safe to not check for it.

I have a PR ready.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error extension-modules C modules in the Modules dir topic-argument-clinic labels Feb 5, 2024
@sobolevn sobolevn self-assigned this Feb 5, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Feb 5, 2024
@serhiy-storchaka
Copy link
Member

PyBuffer_FillInfo() can only set an error if view is NULL or flags has invalid value. Both are impossible in Argument Clinic generated code which passes an address of a local variable as view and PyBUF_SIMPLE as flags.

@erlend-aasland
Copy link
Contributor

Thanks!

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this issue Feb 14, 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 topic-argument-clinic type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants