Skip to content
New issue

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

issue 1682: fibheap.c: add assert to detect decrease_key on node outs… #1688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ddsrt/src/fibheap.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ void ddsrt_fibheap_decrease_key (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap
caller is concerned => declare as const argument, then drop the
const qualifier */
ddsrt_fibheap_node_t *node = (ddsrt_fibheap_node_t *) ((char *) vnode + fhdef->offset);
/* Sanity check that the node is actually part of the heap */
assert(node->next != node ? node->next->prev == node : (node->parent == NULL ? fh->roots == node : node->parent->children == node));

if (node->parent && cmp (fhdef, node->parent, node) <= 0) {
/* heap property not violated, do nothing */
Expand Down