FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

pqueue: resolve possible NULL pointer dereference by pks-t · Pull Request #3976 · libgit2/libgit2 · GitHub

Repository navigation

pqueue: resolve possible NULL pointer dereference - #3976

Merged
pks-t merged 1 commit into
libgit2:masterfrom
pks-t:pks/pqueue-null-deref
Nov 2, 2016
Merged

pks-t merged 1 commit into
libgit2:masterfrom
pks-t:pks/pqueue-null-deref

Conversation

pks-t commented Oct 28, 2016

Copy link
Copy Markdown
Member

The git_pqueue struct allows being fixed in its total number of
entries. In this case, we simply throw away items that are
inserted into the priority queue by examining wether the new item
to be inserted has a higher priority than the previous smallest
one.

This feature somewhat contradicts our pqueue implementation in
that it is allowed to not have a comparison function. In fact, we
also fail to check if the comparison function is actually set in
the case where we add a new item into a fully filled fixed-size
pqueue.

As we cannot determine which item is the smallest item in absence
of a comparison function, we fix the NULL pointer dereference
by simply dropping all new items which are about to be inserted
into a full fixed-size pqueue.

The `git_pqueue` struct allows being fixed in its total number of
entries. In this case, we simply throw away items that are
inserted into the priority queue by examining wether the new item
to be inserted has a higher priority than the previous smallest
one.

This feature somewhat contradicts our pqueue implementation in
that it is allowed to not have a comparison function. In fact, we
also fail to check if the comparison function is actually set in
the case where we add a new item into a fully filled fixed-size
pqueue.

As we cannot determine which item is the smallest item in absence
of a comparison function, we fix the `NULL` pointer dereference
by simply dropping all new items which are about to be inserted
into a full fixed-size pqueue.
pks-t merged commit 19001ca into libgit2:master Nov 2, 2016
pks-t deleted the pks/pqueue-null-deref branch February 8, 2017 15:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

1 participant


Back | FazBrowse Home | New Git URL