Skip to content

Fix missing/incomplete NULL checks in multiple source files #104564

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

Merged
merged 12 commits into from
May 23, 2023

Conversation

chgnrdv
Copy link
Contributor

@chgnrdv chgnrdv commented May 16, 2023

  • Modules/_cursesmodule.c:_curses_initscr_impl: pass screen_encoding to PyCursesWindowObject constructor instead of assigning it to field with possible NULL dereference
  • Modules/_zoneinfo.c:update_strong_cache: check new_node value for NULL
  • Modules/errnomodule.c:errno_exec: prevent leak of error_dict reference in case if module_dict is NULL
  • Modules/posixmodule.c:os_setgroups: check if grouplist is allocated, raise MemoryError otherwise
  • Modules/sha1module.c:newSHA1object: check sha value for NULL
  • Modules/zlibmodule.c:ZlibDecompressor__new__: check self value for NULL

* `Modules/_cursesmodule.c:_curses_initscr_impl`: pass `screen_encoding` to `PyCursesWindowObject` constructor instead of assigning it to field with possible NULL dereference
* `Modules/_zoneinfo.c:update_strong_cache`: check `new_node` value for NULL
* `Modules/errnomodule.c:errno_exec`: prevent leak of `error_dict` reference in case if `module_dict` is NULL
* `Modules/posixmodule.c:os_setgroups`: check if `grouplist` is allocated, raise `MemoryError` otherwise
* `Modules/sha1module.c:newSHA1object`: check `sha` value for NULL
* `Modules/zlibmodule.c:ZlibDecompressor__new__`: check `self` value for NULL
@chgnrdv chgnrdv requested a review from sunmy2019 May 17, 2023 09:48
Copy link
Member

@carljm carljm left a comment

Choose a reason for hiding this comment

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

One suggestion inline of a comment for clarity, but these changes look correct to me.

@sunmy2019 sunmy2019 added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label May 22, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @sunmy2019 for commit c48e5e9 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label May 22, 2023
@carljm carljm merged commit 13b5d79 into python:main May 23, 2023
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.

5 participants