3
0
mirror of https://github.com/Qortal/AT.git synced 2025-01-30 19:02:14 +00:00

Correct bounds check in FunctionCode.getHashData()

The test "functionData.value2 > state.numDataPages" was incorrect
because value2 contains a a BYTE count, so could be up to 8 times
bigger than state.numDataPages!

Reverted back to looser check of "functionData.value2 > Integer.MAX_VALUE"
This commit is contained in:
catbref 2020-04-14 14:56:40 +01:00
parent b0370cc52d
commit aadf987514

View File

@ -1083,7 +1083,7 @@ public enum FunctionCode {
checkDataAddress(state, functionData.value1, 1); checkDataAddress(state, functionData.value1, 1);
// Validate data length in arg2 // Validate data length in arg2
if (functionData.value2 < 0L || functionData.value2 > state.numDataPages || functionData.value1 + byteLengthToDataLength(functionData.value2) > state.numDataPages) if (functionData.value2 < 0L || functionData.value2 > Integer.MAX_VALUE || functionData.value1 + byteLengthToDataLength(functionData.value2) > state.numDataPages)
throw new ExecutionException(this.name() + " data length invalid"); throw new ExecutionException(this.name() + " data length invalid");
final int dataStart = (int) (functionData.value1 & Integer.MAX_VALUE); final int dataStart = (int) (functionData.value1 & Integer.MAX_VALUE);