1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibSQL: Fix BTree corruption in TreeNode::split

After splitting a node, the new node was written to the same pointer as
the current node - probably a copy / paste error. This new code requires
a `.pointer() -> u32` to exist on the object to be serialized,
preventing this issue from happening again.

Fixes #15844.
This commit is contained in:
Jelle Raaijmakers 2022-11-26 01:17:43 +01:00 committed by Andreas Kling
parent e5e00a682b
commit 70a7bca920
7 changed files with 35 additions and 16 deletions

View file

@ -56,7 +56,7 @@ TreeNode* BTree::new_root()
{
set_pointer(new_record_pointer());
m_root = make<TreeNode>(*this, nullptr, m_root.leak_ptr(), pointer());
serializer().serialize_and_write(*m_root.ptr(), m_root->pointer());
serializer().serialize_and_write(*m_root.ptr());
if (on_new_root)
on_new_root();
return m_root;