db_tutorial
db_tutorial copied to clipboard
small bug
Potential Initialization Bug in B+Tree Node Splitting
Report
In db.c:683-689, there's a potential logical error:
if (get_node_type(root) == NODE_INTERNAL) {
initialize_internal_node(right_child);
initialize_internal_node(left_child); // This initialization is lost
}
/* Left child has data copied from old root */
memcpy(left_child, root, PAGE_SIZE); // Overwrites the initialization
The initialize_internal_node(left_child) call is wasted because the subsequent memcpy completely overwrites left_child.