Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Misc/NEWS.d/next/Library/2026-03-09-00-00-00.gh-issue-145678.g…
…rouper-uaf.rst

Co-authored-by: Petr Viktorin <encukou@gmail.com>
  • Loading branch information
sampsonc and encukou authored Mar 12, 2026
commit 39dd69c3ff2bc69c9b201d31e34efdd23472730d
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
Fix a use-after-free in :func:`itertools.groupby`: the internal
``_grouper_next()`` function did not hold strong references to
``gbo->currkey`` and ``igo->tgtkey`` before calling
:c:func:`PyObject_RichCompareBool`, so a re-entrant ``__eq__`` that advanced
the parent iterator (triggering ``groupby_step()`` and ``Py_XSETREF`` on
``currkey``) could free those objects while they were still being compared.
Fix a use-after-free crash in :func:`itertools.groupby` when a user-defined
``__eq__`` advanced the parent iterator while the iterator of groups was advanced.
Comment thread
sampsonc marked this conversation as resolved.
Outdated
The fix mirrors the protection added in :gh:`143543` for ``groupby_next()``.
Comment thread
sampsonc marked this conversation as resolved.
Outdated
Loading