Commit 8b6a2d4230e3065ae873a6c239315fd80e80eaa9
Interface: always take a copy of memory
Alex Beregszaszi committed on 8/25/2016, 2:39:12 AMParent: fa75e6ce5dba39ae90d9ff2364aad9b08d9c4e93
Files changed
interface.js | changed |
interface.js | ||
---|---|---|
@@ -319,9 +319,9 @@ | ||
319 | 319 | } |
320 | 320 | |
321 | 321 | this.takeGas(375 + length * 8 + numberOfTopics * 375) |
322 | 322 | |
323 | - const data = this.getMemory(dataOffset, length) | |
323 | + const data = this.getMemory(dataOffset, length).slice(0) | |
324 | 324 | let topics = [] |
325 | 325 | |
326 | 326 | if (numberOfTopics > 0) { |
327 | 327 | topics.push(U256.fromMemory(this.getMemory(topic1, constants.U256_SIZE_BYTES))) |
@@ -354,9 +354,9 @@ | ||
354 | 354 | create (valueOffset, dataOffset, length) { |
355 | 355 | this.takeGas(32000) |
356 | 356 | |
357 | 357 | const value = U256.fromMemory(this.getMemory(valueOffset, constants.U128_SIZE_BYTES)) |
358 | - const data = this.getMemory(dataOffset, length) | |
358 | + const data = this.getMemory(dataOffset, length).slice(0) | |
359 | 359 | const result = this.environment.create(value, data) |
360 | 360 | return result |
361 | 361 | } |
362 | 362 | |
@@ -377,9 +377,9 @@ | ||
377 | 377 | |
378 | 378 | // Load the params from mem |
379 | 379 | const address = Address.fromMemory(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES)) |
380 | 380 | const value = U256.fromMemory(this.getMemory(valueOffset, constants.U128_SIZE_BYTES)) |
381 | - const data = this.getMemory(dataOffset, dataLength) | |
381 | + const data = this.getMemory(dataOffset, dataLength).slice(0) | |
382 | 382 | // Run the call |
383 | 383 | const [result, errorCode] = this.environment.call(gas, address, value, data) |
384 | 384 | this.setMemory(resultOffset, resultLength, result) |
385 | 385 | return errorCode |
@@ -402,9 +402,9 @@ | ||
402 | 402 | |
403 | 403 | // Load the params from mem |
404 | 404 | const address = Address.fromMemory(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES)) |
405 | 405 | const value = U256.fromMemory(this.getMemory(valueOffset, constants.U128_SIZE_BYTES)) |
406 | - const data = this.getMemory(dataOffset, dataLength) | |
406 | + const data = this.getMemory(dataOffset, dataLength).slice(0) | |
407 | 407 | // Run the call |
408 | 408 | const [result, errorCode] = this.environment.callCode(gas, address, value, data) |
409 | 409 | this.setMemory(resultOffset, resultLength, result) |
410 | 410 | return errorCode |
@@ -425,9 +425,9 @@ | ||
425 | 425 | callDelegate (gas, addressOffset, dataOffset, dataLength, resultOffset, resultLength) { |
426 | 426 | // FIXME: count properly |
427 | 427 | this.takeGas(40) |
428 | 428 | |
429 | - const data = this.getMemory(dataOffset, dataLength) | |
429 | + const data = this.getMemory(dataOffset, dataLength).slice(0) | |
430 | 430 | const address = Address.fromMemory(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES)) |
431 | 431 | const [result, errorCode] = this.environment.callDelegate(gas, address, data) |
432 | 432 | this.setMemory(resultOffset, resultLength, result) |
433 | 433 | return errorCode |
@@ -480,9 +480,9 @@ | ||
480 | 480 | * @param {integer} offset the offset of the output data. |
481 | 481 | * @param {integer} length the length of the output data. |
482 | 482 | */ |
483 | 483 | return (offset, length) { |
484 | - this.environment.returnValue = this.getMemory(offset, length) | |
484 | + this.environment.returnValue = this.getMemory(offset, length).slice(0) | |
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
488 | 488 | * Halt execution and register account for later deletion giving the remaining |
Built with git-ssb-web