Skip to content

Commit a82baeb

Browse files
Merge pull request #6195 from raymondliu0711/feature/clone_tload_value
fix(tvm): clone tload value
2 parents d4f44a7 + 01dd7e1 commit a82baeb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

actuator/src/main/java/org/tron/core/vm/OperationActions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ public static void tLoadAction(Program program) {
649649

650650
byte[] data =
651651
program.getContractState().getTransientStorageValue(address.getData(), key.getData());
652-
DataWord value = data != null ? new DataWord(data) : DataWord.ZERO();
652+
DataWord value = data != null ? new DataWord(data).clone() : DataWord.ZERO();
653653

654654
program.stackPush(value);
655655
program.step();

framework/src/test/java/org/tron/common/runtime/vm/OperationsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,10 @@ public void testTransientStorageOperations() throws ContractValidateException {
960960
program.getContractState().getTransientStorageValue(
961961
program.getContractAddress().getData(), new DataWord(0x01).getData()));
962962

963+
op = new byte[] {0x60, 0x02, 0x60, 0x01, 0x5c, 0x16};
964+
program = new Program(op, op, invoke, interTrx);
965+
testOperations(program);
966+
963967
// TLOAD = 0x5c;
964968
op = new byte[] {0x60, 0x01, 0x5c};
965969
program = new Program(op, op, invoke, interTrx);

0 commit comments

Comments
 (0)