From bd8d8190c8b3f02e398b25e797b4289c85eb97e6 Mon Sep 17 00:00:00 2001 From: Ilan Olkies Date: Wed, 15 Nov 2023 12:55:20 -0300 Subject: [PATCH] Fix rebase conflict --- rskj-core/src/main/java/org/ethereum/util/RLP.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rskj-core/src/main/java/org/ethereum/util/RLP.java b/rskj-core/src/main/java/org/ethereum/util/RLP.java index 5c476ab4985..209160ed765 100644 --- a/rskj-core/src/main/java/org/ethereum/util/RLP.java +++ b/rskj-core/src/main/java/org/ethereum/util/RLP.java @@ -224,6 +224,10 @@ private static Pair decodeListElement(byte[] msgData, int p length = offset + bytesToLength(msgData, position + 1, offset - 1); } + if (Long.compareUnsigned(length, Integer.MAX_VALUE) > 0) { + throw new RLPException("The current implementation doesn't support lengths longer than Integer.MAX_VALUE because that is the largest number of elements an array can have"); + } + if (position + length > msgData.length) { throw new RLPException("The RLP byte array doesn't have enough space to hold an element with the specified length"); }