gh-146065: Fix NULL dereference in FutureIter_am_send#146304
gh-146065: Fix NULL dereference in FutureIter_am_send#146304VanshAgarwal24036 wants to merge 5 commits intopython:mainfrom
Conversation
| try: | ||
| it.throw(RuntimeError) | ||
| except RuntimeError: | ||
| pass |
There was a problem hiding this comment.
Why do we silently suppress this exception here?
There was a problem hiding this comment.
The RuntimeError is intentionally triggered to clear it->future via FutureIter_throw().
There was a problem hiding this comment.
Then do not suppress it but eagerly catch it with assertRaises.
| def test_futureiter_send_after_throw_no_crash(self): | ||
| async def run_test(): | ||
| loop = asyncio.get_event_loop() | ||
| fut = loop.create_future() |
There was a problem hiding this comment.
Alos I would suggest you use the _new_future() helper
There was a problem hiding this comment.
i.e I do not think you need a wrapper and asyncio.run()
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
After throw() or close(), it->future can be NULL. A subsequent send() call would dereference it and crash. This adds a NULL check and raises StopIteration instead.
NULLpointer dereference inFutureIter_am_send#146065