You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@JvmStatic
fun decodeLength(bytes: ByteArray): Pair<Int, ByteArray> {
var newBytes = bytes
var len = 0
var size = 0
while (true) {
val elem = newBytes.first().toInt().also { newBytes = newBytes.drop(1).toByteArray() }
len = len or (elem and 0x7f) shl (size * 7)
size += 1
if ((elem and 0x80) == 0) {
break
}
}
return len to newBytes
}
There is wrong order of bitwise operations for line: len = len or (elem and 0x7f) shl (size * 7)
which is finally impact on wrong length calculation.
It should be fixed with: en = len or ((elem and 0x7f) shl (size * 7))
The text was updated successfully, but these errors were encountered:
@kihonyoo I have compared code with official library Web3 Solana JS. So there is also proof inside JS code. What else I can do to merge this PR into library?
There is wrong order of bitwise operations for line:
len = len or (elem and 0x7f) shl (size * 7)
which is finally impact on wrong length calculation.
It should be fixed with:
en = len or ((elem and 0x7f) shl (size * 7))
The text was updated successfully, but these errors were encountered: