Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
a91e6822
Unverified
Commit
a91e6822
authored
Oct 14, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: check opcode stack before readonly enforcement
parent
41b77455
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
interpreter.go
core/vm/interpreter.go
+10
-13
No files found.
core/vm/interpreter.go
View file @
a91e6822
...
...
@@ -138,10 +138,10 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
pc
=
uint64
(
0
)
// program counter
cost
uint64
// copies used by tracer
stackCopy
=
newstack
()
// stackCopy needed for Tracer since stack is mutated by 63/64 gas rule
pcCopy
uint64
// needed for the deferred Tracer
gasCopy
uint64
// for Tracer to log gas remaining before execution
logged
bool
// deferred Tracer should ignore already logged steps
stackCopy
=
newstack
()
// stackCopy needed for Tracer since stack is mutated by 63/64 gas rule
pcCopy
uint64
// needed for the deferred Tracer
gasCopy
uint64
// for Tracer to log gas remaining before execution
logged
bool
// deferred Tracer should ignore already logged steps
)
contract
.
Input
=
input
...
...
@@ -169,22 +169,19 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
}
}
// get the operation from the jump table matching the opcode
// Get the operation from the jump table matching the opcode and validate the
// stack and make sure there enough stack items available to perform the operation
operation
:=
in
.
cfg
.
JumpTable
[
op
]
if
err
:=
in
.
enforceRestrictions
(
op
,
operation
,
stack
);
err
!=
nil
{
return
nil
,
err
}
// if the op is invalid abort the process and return an error
if
!
operation
.
valid
{
return
nil
,
fmt
.
Errorf
(
"invalid opcode 0x%x"
,
int
(
op
))
}
// validate the stack and make sure there enough stack items available
// to perform the operation
if
err
:=
operation
.
validateStack
(
stack
);
err
!=
nil
{
return
nil
,
err
}
// If the operation is valid, enforce and write restrictions
if
err
:=
in
.
enforceRestrictions
(
op
,
operation
,
stack
);
err
!=
nil
{
return
nil
,
err
}
var
memorySize
uint64
// calculate the new memory size and expand the memory to fit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment