Skip to content

tag._message: avoid NULL pointer dereference - #572

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

jdavid merged 1 commit into
libgit2:masterfrom
olasd:bugfix/tag-_message-null-pointer-deref

Conversation

@olasd

@olasd olasd commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

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

olasd commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

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

2 participants