Skip to content
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

Forgot to add error check? #106916

Closed
Eclips4 opened this issue Jul 20, 2023 · 3 comments
Closed

Forgot to add error check? #106916

Eclips4 opened this issue Jul 20, 2023 · 3 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@Eclips4
Copy link
Member

Eclips4 commented Jul 20, 2023

#106411 adds the _PyCompile_CleanDoc function.
there's a call to PyMem_Malloc, but we don't check if it returns NULL value:

cpython/Python/compile.c

Lines 8055 to 8063 in 009e8f0

char *buff = PyMem_Malloc(doc_size);
char *w = buff;
while (p < pend) {
int ch = *w++ = *p++;
if (ch == '\n') {
break;
}
}

Is there a need to check for a NULL value?
If so, I can send a PR.

Linked PRs

@Eclips4 Eclips4 added the type-bug An unexpected behavior, bug, or error label Jul 20, 2023
@Eclips4
Copy link
Member Author

Eclips4 commented Jul 20, 2023

cc @methane

@methane
Copy link
Member

methane commented Jul 20, 2023

Yes, I forgot. Thank you.
Would you create a pull request, or may I?

@Eclips4
Copy link
Member Author

Eclips4 commented Jul 20, 2023

I'll soon send a pull request =)

Eclips4 added a commit to Eclips4/cpython that referenced this issue Jul 20, 2023
methane pushed a commit that referenced this issue Jul 21, 2023
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@methane methane closed this as completed Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants