Skip to content
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

tag._message: avoid NULL pointer dereference #572

Merged

Conversation

olasd
Copy link
Contributor

@olasd olasd commented Oct 5, 2015

A tag message can be empty. In that case, git_tag_message returns
NULL. PyBytes_FromString doesn't check its argument for nullness, and
therefore accessing _message on a tag with an empty message segfaults
Python.

A tag message can be empty. In that case, git_tag_message returns
NULL. PyBytes_FromString doesn't check its argument for nullness, and
therefore accessing _message on a tag with an empty message segfaults
Python.
@olasd
Copy link
Contributor Author

olasd commented Oct 5, 2015

Test case: https://github.com/melo/anyevent--xmpp

>>> import pygit2
>>> repo = pygit2.Repository('.')
>>> repo['a0f7aefc8eb9b70fd01866dae9a62386d71715b3'].message is None
True
>>> repo['a0f7aefc8eb9b70fd01866dae9a62386d71715b3']._message
Erreur de segmentation # (= segfault)
# interpreter exits

@jdavid jdavid merged commit eadc2a3 into libgit2:master Oct 6, 2015
@olasd olasd deleted the bugfix/tag-_message-null-pointer-deref branch October 6, 2015 08:17
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