Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
[trace] check mem diff within range (#11002)
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian authored and s3krit committed Aug 29, 2019
1 parent ff398fe commit f00d2e4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ethcore/src/trace/executive_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use ethereum_types::{U256, Address};
use vm::{Error as VmError, ActionParams};
use log::{debug, warn};
use trace::trace::{Call, Create, Action, Res, CreateResult, CallResult, VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, Suicide, Reward, RewardType};
use trace::{Tracer, VMTracer, FlatTrace};

Expand Down Expand Up @@ -245,7 +246,19 @@ impl VMTracer for ExecutiveVMTracer {
}

fn trace_executed(&mut self, gas_used: U256, stack_push: &[U256], mem: &[u8]) {
let mem_diff = self.last_mem_written.take().map(|(o, s)| (o, &(mem[o..o+s])));
let mem_diff = self.last_mem_written.take().map(|(o, s)| {
if o + s > mem.len() {
warn!(
target: "trace",
"Last mem written is out of bounds {} (mem is {})",
o + s,
mem.len(),
);
(o, &[][..])
} else {
(o, &(mem[o..o+s]))
}
});
let store_diff = self.last_store_written.take();
Self::with_trace_in_depth(&mut self.data, self.depth, move |trace| {
let ex = VMExecutedOperation {
Expand Down

0 comments on commit f00d2e4

Please sign in to comment.