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
29c887ef
Commit
29c887ef
authored
Dec 30, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed incorrect range check for push
parent
9d429180
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
closure.go
vm/closure.go
+7
-10
vm_debug.go
vm/vm_debug.go
+3
-2
No files found.
vm/closure.go
View file @
29c887ef
package
vm
import
(
"math"
"math/big"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
)
...
...
@@ -51,19 +53,14 @@ func (c *Closure) GetByte(x uint64) byte {
}
func
(
c
*
Closure
)
GetBytes
(
x
,
y
int
)
[]
byte
{
if
x
>=
len
(
c
.
Code
)
||
y
>=
len
(
c
.
Code
)
{
return
nil
}
return
c
.
Code
[
x
:
x
+
y
]
return
c
.
GetRangeValue
(
uint64
(
x
),
uint64
(
y
))
}
func
(
c
*
Closure
)
GetRangeValue
(
x
,
y
uint64
)
[]
byte
{
if
x
>=
uint64
(
len
(
c
.
Code
))
||
y
>=
uint64
(
len
(
c
.
Code
))
{
return
nil
}
func
(
c
*
Closure
)
GetRangeValue
(
x
,
size
uint64
)
[]
byte
{
x
=
uint64
(
math
.
Min
(
float64
(
x
),
float64
(
len
(
c
.
Code
))))
y
:=
uint64
(
math
.
Min
(
float64
(
x
+
size
),
float64
(
len
(
c
.
Code
))))
return
c
.
Code
[
x
:
x
+
y
]
return
ethutil
.
LeftPadBytes
(
c
.
Code
[
x
:
y
],
int
(
size
))
}
func
(
c
*
Closure
)
Return
(
ret
[]
byte
)
[]
byte
{
...
...
vm/vm_debug.go
View file @
29c887ef
...
...
@@ -716,7 +716,8 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
//a := big.NewInt(int64(op) - int64(PUSH1) + 1)
a
:=
uint64
(
op
-
PUSH1
+
1
)
//pc.Add(pc, ethutil.Big1)
val
:=
ethutil
.
BigD
(
closure
.
GetRangeValue
(
pc
+
1
,
a
))
byts
:=
closure
.
GetRangeValue
(
pc
+
1
,
a
)
val
:=
ethutil
.
BigD
(
byts
)
// Push value to stack
stack
.
Push
(
val
)
pc
+=
a
...
...
@@ -724,7 +725,7 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price *
step
+=
int
(
op
)
-
int
(
PUSH1
)
+
1
self
.
Printf
(
" => 0x%x"
,
val
.
Bytes
()
)
self
.
Printf
(
" => 0x%x"
,
byts
)
case
POP
:
stack
.
Pop
()
case
DUP1
,
DUP2
,
DUP3
,
DUP4
,
DUP5
,
DUP6
,
DUP7
,
DUP8
,
DUP9
,
DUP10
,
DUP11
,
DUP12
,
DUP13
,
DUP14
,
DUP15
,
DUP16
:
...
...
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