good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
a91e6822
Unverified
Commit
a91e6822
authored
7 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
core/vm: check opcode stack before readonly enforcement
parent
41b77455
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/vm/interpreter.go
+10
-13
10 additions, 13 deletions
core/vm/interpreter.go
with
10 additions
and
13 deletions
core/vm/interpreter.go
+
10
−
13
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment