Fix SHAMapTreeNode deserialization

This commit is contained in:
Nik Bougalis
2015-07-02 11:30:48 -07:00
committed by Vinnie Falco
parent 4dc573f195
commit 6a093b1b44

View File

@@ -157,12 +157,11 @@ SHAMapAbstractNode::make(Blob const& rawNode, std::uint32_t seq, SHANodeFormat f
for (int i = 0; i < (len / 33); ++i)
{
int pos;
s.get8 (pos, 32 + (i * 33));
if ((pos < 0) || (pos >= 16)) throw std::runtime_error ("invalid CI node");
if (!s.get8 (pos, 32 + (i * 33)))
throw std::runtime_error ("short CI node");
if ((pos < 0) || (pos >= 16))
throw std::runtime_error ("invalid CI node");
s.get256 (ret->mHashes[pos], i * 33);
if (ret->mHashes[pos].isNonZero ())
ret->mIsBranch |= (1 << pos);
}