tests/core/pqueue.c


Log

Author Commit Date CI Message
Patrick Steinhardt 95fa3880 2016-10-28T16:07:40 pqueue: resolve possible NULL pointer dereference 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.
Russell Belfer 5302a885 2014-03-12T11:21:55 Fix pqueue sort boundary condition bug If the pqueue comparison fn returned just 0 or 1 (think "a<b") then the sort order of returned items could be wrong because there was a "< 0" that really needed to be "<= 0". Yikes!!!
Russell Belfer af4bc661 2014-02-03T21:04:40 Add some priority queue tests I forgot that I wrote some tests for the new priority queue code.