Skip to content

tag._message: avoid NULL pointer dereference#572

Merged
jdavid merged 1 commit intolibgit2:masterfrom
olasd:bugfix/tag-_message-null-pointer-deref
Oct 6, 2015
Merged

tag._message: avoid NULL pointer dereference#572
jdavid merged 1 commit intolibgit2:masterfrom
olasd:bugfix/tag-_message-null-pointer-deref

Conversation

@olasd
Copy link
Copy Markdown
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
Copy Markdown
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