Skip to content

Commit ea0e29e

Browse files
authored
Merge pull request ethereumjs#454 from ethereumjs/fix/call-id-test
Fix longer output than return length in call opcode
2 parents 3a06f0c + 2fab756 commit ea0e29e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/vm/opFns.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,12 @@ function makeCall (runState, callOptions, localOpts, cb) {
10471047
// save results to memory
10481048
if (results.vm.return && (!results.vm.exceptionError || results.vm.exceptionError.error === ERROR.REVERT)) {
10491049
if (results.vm.return.length > 0) {
1050-
const data = getDataSlice(results.vm.return, new BN(0), localOpts.outLength)
10511050
const memOffset = localOpts.outOffset.toNumber()
1052-
const dataLength = localOpts.outLength.toNumber()
1051+
let dataLength = localOpts.outLength.toNumber()
1052+
if (results.vm.return.length < dataLength) {
1053+
dataLength = results.vm.return.length
1054+
}
1055+
const data = getDataSlice(results.vm.return, new BN(0), new BN(dataLength))
10531056
runState.memory.extend(memOffset, dataLength)
10541057
runState.memory.write(memOffset, dataLength, data)
10551058
}

tests/tester.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const {
99
} = require('./util')
1010
// tests which should be fixed
1111
const skipBroken = [
12-
'CallIdentity_6_inputShorterThanOutput', // temporary till fixed (2018-11-14)
1312
'ecmul_0-3_5616_28000_96', // temporary till fixed (2018-09-20)
1413
'dynamicAccountOverwriteEmpty' // temporary till fixed (2019-01-30), skipped along constantinopleFix work time constraints
1514
]

0 commit comments

Comments
 (0)