Skip to content

Conversation

@brianfcoleman
Copy link
Contributor

On PyMem_Malloc failure, _PyCode_SetExtra should set co_extra->ce_size = 0.
On PyMem_Realloc failure, _PyCode_SetExtra should set co_extra->ce_size = 0.
On PyMem_Realloc success, _PyCode_SetExtra should set all unused slots in co_extra->ce_extras to NULL.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow these steps to rectify the issue:

  1. Sign the PSF contributor agreement. The "bugs.python.org username" requested by the form is the "Login name" field in "Your Details" at b.p.o
  2. Wait at least one US business day and then check the "Contributor form received entry under "Your Details" on bugs.python.org to see if your account has been marked as having signed the CLA (the delay is due to a person having to manually check your signed CLA)
  3. Reply here saying you have completed the above steps

Thanks again to your contribution and we look forward to looking at it!

@mention-bot
Copy link

@brianfcoleman, thanks for your PR! By analyzing the history of the files in this pull request, we identified @brettcannon, @avassalotti, @gvanrossum, @1st1 and @vadmium to be potential reviewers.

Copy link
Member

Choose a reason for hiding this comment

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

Previously allocated co_extra->ce_extras is leaked if PyMem_Realloc() returns NULL. It would be better to save the result of PyMem_Realloc() to the variable and check it for NULL first than assign it to co_extra->ce_extras.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have made this change

Copy link
Member

Choose a reason for hiding this comment

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

Would not be better to deallocate o->co_extra and set it to NULL rather of setting co_extra->ce_size to 0?

Copy link
Member

Choose a reason for hiding this comment

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

Nice catch.

@serhiy-storchaka serhiy-storchaka self-assigned this Mar 1, 2017
@serhiy-storchaka
Copy link
Member

@brianfcoleman, please sign the CLA and add an entry in Misc/NEWS.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM except minor details of Misc/NEWS entry.

Misc/NEWS Outdated
Copy link
Member

Choose a reason for hiding this comment

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

New entries usually added are added at the start of corresponding section, so that entries are list in reversed chronological order.

It is recommended to use two spaces after sentence-ending period.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made this change

allocated.

On PyMem_Realloc failure, _PyCode_SetExtra should free co_extra if
co_extra->ce_extras could not be allocated.
On PyMem_Realloc success, _PyCode_SetExtra should set all unused slots in
co_extra->ce_extras to NULL.
@vstinner vstinner merged commit 6a9122c into python:master Mar 2, 2017
@vstinner
Copy link
Member

vstinner commented Mar 2, 2017

Thanks @brianfcoleman for your contribution! Would you mind to backport the change to Python 3.6?

@brianfcoleman
Copy link
Contributor Author

@Haypo I have created a pull request to backport the fix to 3.6 here:
#402

@serhiy-storchaka serhiy-storchaka removed their assignment Dec 6, 2018
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Bumps [codecov](https://github.com/codecov/codecov-python) from 2.1.7 to 2.1.9.
- [Release notes](https://github.com/codecov/codecov-python/releases)
- [Changelog](https://github.com/codecov/codecov-python/blob/master/CHANGELOG.md)
- [Commits](codecov/codecov-python@v2.1.7...v2.1.9)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Mariatta <[email protected]>
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

Successfully merging this pull request may close these issues.

6 participants