Skip to content

Obj reached not through tree caused Segmentation fault on raw_name access #1002

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 1 commit into from
Apr 19, 2020

Conversation

buhl
Copy link
Contributor

@buhl buhl commented Apr 18, 2020

While tab completing in the repl on the . of a blob object accessed not through the tree I caused a segfault.
I found out the repl calls inspect.getmemebers on the object which again tries to access raw_name.
I took the check from .name property and applied to to .raw_name

This is on python 3.8.2

Before fix

>>> import os, pygit2, inspect
>>> r = pygit2.Repository("/home/user/repos/pygit2")
>>> b = r.get("855c845e538b")
>>> inspect.getmembers(b)
Segmentation fault (core dumped)

After fix

>>> import os, pygit2, inspect
>>> r = pygit2.Repository("/home/user/repos/pygit2")
>>> b = r.get("855c845e538b")
>>> inspect.getmembers(b)
[('__class__', <class '_pygit2.Blob'>), 

# ...

('short_id', '855c845'), ('size', 444379), ('type', 3), ('type_str', 'blob')]

@jdavid jdavid merged commit cb20c8d into libgit2:master Apr 19, 2020
@buhl buhl deleted the fix-core-dump branch April 19, 2020 11:12
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