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
merged 1 commit into from Oct 6, 2015

Conversation

Projects
None yet
2 participants
@olasd
Contributor

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.

tag._message: avoid NULL pointer dereference
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

This comment has been minimized.

Contributor

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@olasd olasd deleted the olasd:bugfix/tag-_message-null-pointer-deref branch Oct 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment