mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Fix use-after-modify when adding new key as subset of old key
This commit is contained in:
@@ -457,16 +457,19 @@ private:
|
||||
Key prefixAfter = prefix.ExclusiveSuffixAfter(search.size);
|
||||
Key prefixBefore = prefix.ExclusivePrefixBefore(search.size);
|
||||
|
||||
// the current node will be appended on after, so truncate its key
|
||||
// the current node will be appended on as a child, it will truncate its key to prefixAfter
|
||||
NodeOrLeaf *oldRoot = root;
|
||||
oldRoot->SetPrefix(prefixAfter);
|
||||
|
||||
// create a new node with the prefix before
|
||||
// this can be a small2 node as we only need one child so far
|
||||
SmallNode<2> *newRoot = MakeNode<SmallNode<2>>();
|
||||
newRoot->SetPrefix(prefixBefore);
|
||||
root = newRoot;
|
||||
|
||||
// set new root prefix first as this copies into the node, both prefixBefore and prefixAfter
|
||||
// reference subsets of the old prefix (which is stored in oldRoot)
|
||||
newRoot->SetPrefix(prefixBefore);
|
||||
oldRoot->SetPrefix(prefixAfter);
|
||||
|
||||
// the old root is appended on after the right child
|
||||
newRoot->childBytes[0] = firstExtraKeyByte;
|
||||
newRoot->children[0] = oldRoot;
|
||||
|
||||
Reference in New Issue
Block a user