Skip to content

Commit

Permalink
HPCC-31525 Report a more specific error if part of an index file has …
Browse files Browse the repository at this point in the history
…been zeroed

Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Mar 27, 2024
1 parent 4afc639 commit c9d1604
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions system/jhtree/ctfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,17 @@ void CJHLegacySearchNode::load(CKeyHdr *_keyHdr, const void *rawData, offset_t _
else {
keyBuf = NULL;
expandedSize = 0;
if (hdr.nodeType == NodeBranch)
{
if ((hdr.leftSib == 0) && (hdr.rightSib == 0))
{
//Sanity check to catch error where a section of the file has unexpectedly been zeroed.
//which is otherwise tricky to track down.
//This can only legally happen if there is an index with 0 entries
if (keyHdr->getNumRecords() != 0)
throw MakeStringException(0, "Zeroed index node detected at offset %llu", getFpos());
}
}
}
}
}
Expand Down

0 comments on commit c9d1604

Please sign in to comment.