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
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
a91e6822
Unverified
Commit
a91e6822
authored
Oct 14, 2017
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
core/vm: check opcode stack before readonly enforcement
parent
41b77455
No related branches found
No related tags found
No related merge requests found
Changes
1
Show 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
...
@@ -169,22 +169,19 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
...
@@ -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
]
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
{
if
!
operation
.
valid
{
return
nil
,
fmt
.
Errorf
(
"invalid opcode 0x%x"
,
int
(
op
))
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
{
if
err
:=
operation
.
validateStack
(
stack
);
err
!=
nil
{
return
nil
,
err
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
var
memorySize
uint64
// calculate the new memory size and expand the memory to fit
// 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