|
@@ -106,7 +106,7 @@ extern bool isCompressedIndex(const char *filename)
|
|
|
if (io->read(0, sizeof(hdr), &hdr) == sizeof(hdr))
|
|
|
{
|
|
|
SwapBigEndian(hdr);
|
|
|
- if (size % hdr.nodeSize == 0 && hdr.phyrec == size-1 && hdr.root && hdr.root % hdr.nodeSize == 0 && hdr.ktype & (HTREE_COMPRESSED_KEY|HTREE_QUICK_COMPRESSED_KEY))
|
|
|
+ if (hdr.nodeSize && (size % hdr.nodeSize == 0) && (hdr.phyrec == size-1) && hdr.root && (hdr.root % hdr.nodeSize == 0) && (hdr.ktype & (HTREE_COMPRESSED_KEY|HTREE_QUICK_COMPRESSED_KEY)))
|
|
|
{
|
|
|
NodeHdr root;
|
|
|
if (io->read(hdr.root, sizeof(root), &root) == sizeof(root))
|
|
@@ -843,7 +843,7 @@ extern jhtree_decl void validateKeyFile(const char *filename, offset_t nodePos)
|
|
|
_WINREV(hdr.nodeSize);
|
|
|
if (hdr.phyrec != size-1)
|
|
|
throw MakeStringException(5, "Invalid key %s: phyrec was %" I64F "d, expected %" I64F "d", filename, hdr.phyrec, size-1);
|
|
|
- if (size % hdr.nodeSize)
|
|
|
+ if (!hdr.nodeSize || size % hdr.nodeSize)
|
|
|
throw MakeStringException(3, "Invalid key %s: size %" I64F "d is not a multiple of key node size (%d)", filename, size, hdr.nodeSize);
|
|
|
if (!hdr.root || hdr.root % hdr.nodeSize !=0)
|
|
|
throw MakeStringException(6, "Invalid key %s: invalid root pointer %" I64F "x", filename, hdr.root);
|