Due the investigations done to fix the JRE/JDK bug we've found the following statements:
1)The keys in the memory structure are not placed sorted, but they are placed in a descendent order.
2) So when a new entry is added,which forces a split, the entry is placed incorrectly in the wrong leaf.
The memory dump before inserting the entry which forces a split is:
Here we can see how the "ChildXXXX" are placed in memory in a descendent order in just one "leaf"(List)
The expected order should be:
This is the first bug.
Now, when the "Child1013" is created, we are forcing the split creating 2 leafs, Leaf1 being List and Leaf2 being List. The memory structure in ReactOS becomes as follows:
As you can see, the List goes downwards from Child1012 to Child0508, and the second leaf stores from "Child0507" to "Child001". The split is correctly done, however due to the previous bug we have wrongly "downwards" sorted the list
In the split, the entry is wrongly placed. Really it is following the correct logic as it places the "Child1013" entry AFTER the highest value in the 2nd leaf however,since the list is not correctly sorted, the highest value in the second leaf is not "Child1012" but "Child0507".
The expected sorted ordering is:
Basically, what it's failing is:
- Adding a entry thinking the list is already sorted when it is not. Hence it is incorrectly placed in the wrong leaf, and much worse, the Cmp....Index functions are prone to assert since they need a sorted list to work correctly otherwise the binary search wont work.