- Do not set result variable NodeOrParent in RtlpFindGenericTableNodeOrParent in case the generic table is empty, just returning TableEmptyTree is enough.
- Fix improper enumeration of generic tables nodes. The way they were done previously clearly shows that noone was actually testing these APIs and a simple mistake (do/while instead of while loop) led to a NULL pointer access. Thanks to Pierre for developing MCB tests which revealed this problem.
Rephrasing Vladimir Lenin: "Test, test and again test!"

svn path=/trunk/; revision=58848
This commit is contained in:
Aleksey Bragin 2013-04-24 22:56:43 +00:00
parent 2840256492
commit 53f025c83e

View file

@ -34,7 +34,6 @@ RtlpFindGenericTableNodeOrParent(IN PRTL_GENERIC_TABLE Table,
/* Quick check to see if the table is empty */
if (RtlIsGenericTableEmpty(Table))
{
*NodeOrParent = NULL;
return TableEmptyTree;
}
@ -338,11 +337,11 @@ RtlEnumerateGenericTable(IN PRTL_GENERIC_TABLE Table,
{
/* Then find the leftmost element */
FoundNode = Table->TableRoot;
do
while(RtlLeftChild(FoundNode))
{
/* Get the left child */
FoundNode = RtlLeftChild(FoundNode);
} while(RtlLeftChild(FoundNode));
}
/* Splay it */
_Analysis_assume_(FoundNode != NULL);
@ -377,11 +376,11 @@ RtlEnumerateGenericTableWithoutSplaying(IN PRTL_GENERIC_TABLE Table,
{
/* Then find the leftmost element */
FoundNode = Table->TableRoot;
do
while(RtlLeftChild(FoundNode))
{
/* Get the left child */
FoundNode = RtlLeftChild(FoundNode);
} while(RtlLeftChild(FoundNode));
}
/* Splay it */
*RestartKey = FoundNode;