Skip to content

Commit

Permalink
Add precautionary cast to long in length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminion committed Aug 13, 2020
1 parent cfca39c commit 7e11912
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rlp/src/main/java/org/web3j/rlp/RlpDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private static int calcLength(int lengthOfLength, byte[] data, int pos) {
byte pow = (byte) (lengthOfLength - 1);
long length = 0;
for (int i = 1; i <= lengthOfLength; ++i) {
length += (data[pos + i] & 0xff) << (8 * pow);
length += ((long) (data[pos + i] & 0xff)) << (8 * pow);
pow--;
}
if (length < 0 || length > Integer.MAX_VALUE) {
Expand Down

0 comments on commit 7e11912

Please # to comment.