* _SeekDown() now checks if it has already reached the maximum tree

depth, and will bail out if it hasn't reached the leaf level then.
* This should at least avoid the crash of bug #1911; there is not much
  more I can do about that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24411 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-03-16 16:26:05 +00:00
parent d89cda9ff7
commit 7a3ecb82ba

View File

@ -723,13 +723,18 @@ BPlusTree::_SeekDown(Stack<node_and_key> &stack, const uint8 *key,
if (status == B_ENTRY_NOT_FOUND && nextOffset == nodeAndKey.nodeOffset)
RETURN_ERROR(B_ERROR);
if ((uint32)stack.CountItems() > fHeader->MaxNumberOfLevels()) {
dprintf("BPlusTree::_SeekDown() node walked too deep.\n");
break;
}
// put the node offset & the correct keyIndex on the stack
stack.Push(nodeAndKey);
nodeAndKey.nodeOffset = nextOffset;
}
FATAL(("BPlusTree::SeekDown() could not open node %Ld\n",
FATAL(("BPlusTree::_SeekDown() could not open node %Ld\n",
nodeAndKey.nodeOffset));
return B_ERROR;
}