Skip to content

Fix abort with nested Tree iteration#984

Merged
jdavid merged 1 commit into
libgit2:masterfrom
koordinates:fix-nested-iter
Mar 3, 2020
Merged

Fix abort with nested Tree iteration#984
jdavid merged 1 commit into
libgit2:masterfrom
koordinates:fix-nested-iter

Conversation

@rcoup

@rcoup rcoup commented Mar 2, 2020

Copy link
Copy Markdown
Contributor

When doing nested iteration of a Tree, Python crashes with an Abort from a libgit2 assert in git_tree_entry_byindex().

Code to reproduce:

for obj in some_tree:
    if isinstance(obj, pygit2.Tree):
        for obj2 in obj:
            pass

Fix is to ensure Trees are fully-loaded via Object__load() before creating a TreeIter, otherwise self->owner->tree in TreeIter_iternext() can resolve to NULL.

Ensure Trees are fully-loaded before creating a TreeIter.
rcoup added a commit to koordinates/kart that referenced this pull request Mar 2, 2020
* Swap stdlib Sqlite -> APSW
* Pygit2 1.x. Switch to fix for libgit2/pygit2#984
* Fix all the tests
@jdavid jdavid merged commit ccf4df1 into libgit2:master Mar 3, 2020
@rcoup rcoup deleted the fix-nested-iter branch March 3, 2020 13:49
netbsd-srcmastr referenced this pull request in NetBSD/pkgsrc Mar 10, 2020
1.1.1 (2020-03-06)
-------------------------

- Fix crash in tree iteration
  `#984 <https://github.com/libgit2/pygit2/pull/984>`_
  `#980 <https://github.com/libgit2/pygit2/issues/980>`_

- Do not include the docs in dist files, so they're much smaller now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants