Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
ac06c5ed
Commit
ac06c5ed
authored
Dec 07, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add error checking on file open
parent
5af95462
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
run_unicorn.go
mipsevm/run_unicorn.go
+7
-3
No files found.
mipsevm/run_unicorn.go
View file @
ac06c5ed
...
...
@@ -83,7 +83,8 @@ func GetHookedUnicorn(root string, ram map[uint32](uint32), callback func(int, u
oracle_hash
,
_
:=
mu
.
MemRead
(
0x30001000
,
0x20
)
hash
:=
common
.
BytesToHash
(
oracle_hash
)
key
:=
fmt
.
Sprintf
(
"%s/%s"
,
root
,
hash
)
value
,
_
:=
ioutil
.
ReadFile
(
key
)
value
,
err
:=
ioutil
.
ReadFile
(
key
)
check
(
err
)
tmp
:=
[]
byte
{
0
,
0
,
0
,
0
}
binary
.
BigEndian
.
PutUint32
(
tmp
,
uint32
(
len
(
value
)))
...
...
@@ -179,7 +180,9 @@ func RunUnicorn(fn string, ram map[uint32](uint32), checkIO bool, callback func(
mu
.
MemWrite
(
0
,
dat
)
// inputs
inputs
,
_
:=
ioutil
.
ReadFile
(
fmt
.
Sprintf
(
"%s/input"
,
root
))
inputs
,
err
:=
ioutil
.
ReadFile
(
fmt
.
Sprintf
(
"%s/input"
,
root
))
check
(
err
)
mu
.
MemWrite
(
0x30000000
,
inputs
[
0
:
0xc0
])
// load into ram
...
...
@@ -191,7 +194,8 @@ func RunUnicorn(fn string, ram map[uint32](uint32), checkIO bool, callback func(
mu
.
Start
(
0
,
0x5ead0004
)
if
checkIO
{
outputs
,
_
:=
ioutil
.
ReadFile
(
fmt
.
Sprintf
(
"%s/output"
,
root
))
outputs
,
err
:=
ioutil
.
ReadFile
(
fmt
.
Sprintf
(
"%s/output"
,
root
))
check
(
err
)
real
:=
append
([]
byte
{
0x13
,
0x37
,
0xf0
,
0x0d
},
outputs
...
)
output
,
_
:=
mu
.
MemRead
(
0x30000800
,
0x44
)
if
bytes
.
Compare
(
real
,
output
)
!=
0
{
...
...
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