mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
[RTL]
- 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:
parent
2840256492
commit
53f025c83e
1 changed files with 4 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue