small bug

Author: RFoeCreated Mar 30, 2025Updated Apr 12, 2025

Potential Initialization Bug in B+Tree Node Splitting

Report

In db.c:683-689, there's a potential logical error:

c
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.