From 09ff044b6739983f908d2537281f0e105d8caa20 Mon Sep 17 00:00:00 2001 From: Maxksim Fomenkov Date: Thu, 1 Sep 2022 18:10:08 +0300 Subject: [PATCH] fix array out of bound exception --- .../dshackle/upstream/ethereum/EthereumBlockValidator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumBlockValidator.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumBlockValidator.kt index 25a84293..3fc2ea84 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumBlockValidator.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumBlockValidator.kt @@ -174,7 +174,7 @@ class EthereumBlockValidator : BlockValidator { private fun BigInteger.asUint64() = this.toByteArray().let { bytes -> ByteArray(8) { val index = bytes.size - it - 1 - if (index < bytes.size) bytes[index] else 0 + if (index < bytes.size && index >= 0) bytes[index] else 0 } }