Closed JaviMuller closed 10 months ago
When calling the function get_successor_node on the root, if it is the node with the greatest key, it will try to access x->parent->right. Here is a minimal reproducibility example (get_greater_than will call get_successor_node):
#include "cc_treetable.h" #include <stdio.h> int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main() { CC_TreeTable *table; int (*comp)(const void *, const void *) = &cmp; if (cc_treetable_new(comp, &table) != CC_OK) return -1; void *out; int key = 1; cc_treetable_add(table, &key, &key); cc_treetable_get_greater_than(table, &key1, &out); // SEGFAULT cc_treetable_destroy(table); }
Tried to dereference out
When calling the function get_successor_node on the root, if it is the node with the greatest key, it will try to access x->parent->right. Here is a minimal reproducibility example (get_greater_than will call get_successor_node):