We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This fixes an out-of-bounds lookup, which results in a segfault when popping/heapifying:
diff --git a/src/pqueue.c b/src/pqueue.c index 0293922..875d40c 100644 --- a/src/pqueue.c +++ b/src/pqueue.c @@ -306,13 +306,13 @@ static void pqueue_heapify(PQueue *pq, size_t index) size_t R = CC_RIGHT(index); size_t tmp = index; + if (L >= pq->size || R >= pq->size) + return; + void *left = pq->buffer[L]; void *right = pq->buffer[R]; void *indexPtr = pq->buffer[index]; - if (L >= pq->size || R >= pq->size) - return; - if (pq->cmp(indexPtr, left) < 0) { indexPtr = left; index = L;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This fixes an out-of-bounds lookup, which results in a segfault when popping/heapifying:
The text was updated successfully, but these errors were encountered: