Skip to content

Commit 7526c22

Browse files
committed
keys checking
1 parent 5ff5d04 commit 7526c22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/scala/scorex/crypto/authds/avltree/batch/serialization/BatchAVLProverSerializer.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ class BatchAVLProverSerializer[D <: Digest, HF <: CryptographicHash[D]](implicit
128128
val rightBytes = bytes.slice(keyLength + 6 + leftLength, bytes.length)
129129
val left = loop(leftBytes)
130130
val right = loop(rightBytes)
131+
val keyAsNum = BigInt(1, key)
132+
require(BigInt(1, left.key) < keyAsNum && keyAsNum <= BigInt(1, right.key), s"key check fail")
131133
new InternalProverNode[D](key, left, right, balance)
132134
case 2 =>
133135
val balance = Balance @@ bytes.slice(1, 2).head

0 commit comments

Comments
 (0)