Skip to content

bpo-36367: Free buffer if realloc fails in tokenize.c#12442

Merged
pablogsal merged 1 commit into
python:masterfrom
pablogsal:bpo36367
Mar 19, 2019
Merged

bpo-36367: Free buffer if realloc fails in tokenize.c#12442
pablogsal merged 1 commit into
python:masterfrom
pablogsal:bpo36367

Conversation

@pablogsal

@pablogsal pablogsal commented Mar 19, 2019

Copy link
Copy Markdown
Member

@matrixise matrixise left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I had the same solution, seems to be fine for me.

@remilapeyre remilapeyre left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @pablogsal I think there is the same issue in https://github.com/python/cpython/blob/dce242187f25b6861b08fe5d7e581efcfc49ea21/Parser/tokenizer.c#L891. Can you fix it too?

I think the cast to char * there is also not needed.

@remilapeyre

Copy link
Copy Markdown

Comment thread Parser/tokenizer.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you move result declaration where it's used? Python 3.8 now allows C99 ;-) (see PEP 7)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done! :)

@pablogsal

Copy link
Copy Markdown
Member Author

@remilapeyre remilapeyre left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@pablogsal Yes it is, I think you patch is correct now.

@pablogsal pablogsal merged commit cb90c89 into python:master Mar 19, 2019
@pablogsal pablogsal deleted the bpo36367 branch March 19, 2019 17:18
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-12470 is a backport of this pull request to the 2.7 branch.

@bedevere-bot

Copy link
Copy Markdown

GH-12471 is a backport of this pull request to the 3.7 branch.

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.

7 participants