Skip to content

Commit 7e11912

Browse files
committed
Add precautionary cast to long in length calculation
1 parent cfca39c commit 7e11912

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rlp/src/main/java/org/web3j/rlp/RlpDecoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static int calcLength(int lengthOfLength, byte[] data, int pos) {
188188
byte pow = (byte) (lengthOfLength - 1);
189189
long length = 0;
190190
for (int i = 1; i <= lengthOfLength; ++i) {
191-
length += (data[pos + i] & 0xff) << (8 * pow);
191+
length += ((long) (data[pos + i] & 0xff)) << (8 * pow);
192192
pow--;
193193
}
194194
if (length < 0 || length > Integer.MAX_VALUE) {

0 commit comments

Comments
 (0)