Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swen90006-a2-2018
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Callum Bradshaw
swen90006-a2-2018
Commits
aceca5c0
Commit
aceca5c0
authored
Oct 13, 2018
by
ryuzakighost
Browse files
Options
Downloads
Plain Diff
merge
parents
62599f95
85d081e5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/machine-vuln4.c
+1
-1
1 addition, 1 deletion
src/machine-vuln4.c
src/machine-vuln5.c
+5
-5
5 additions, 5 deletions
src/machine-vuln5.c
src/pocs/poc4.s
+1
-0
1 addition, 0 deletions
src/pocs/poc4.s
with
7 additions
and
6 deletions
src/machine-vuln4.c
+
1
−
1
View file @
aceca5c0
...
@@ -58,7 +58,7 @@ static void machine_init(void){
...
@@ -58,7 +58,7 @@ static void machine_init(void){
memory
=
malloc
(
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
memory
=
malloc
(
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
regs
=
malloc
(
sizeof
(
int32_t
)
*
NUM_REGS
);
regs
=
malloc
(
sizeof
(
int32_t
)
*
NUM_REGS
);
memset
(
memory
,
0
,
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
memset
(
memory
,
0
,
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
memset
(
regs
,
0
,
sizeof
(
int32_t
)
*
NUM_REGS
);
memset
(
regs
,
0
,
sizeof
(
int32_t
)
*
(
NUM_REGS
-
1
)
);
count
=
0
;
count
=
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/machine-vuln5.c
+
5
−
5
View file @
aceca5c0
...
@@ -57,8 +57,8 @@ unsigned int count = 0; /* counts number of instructions executed so far */
...
@@ -57,8 +57,8 @@ unsigned int count = 0; /* counts number of instructions executed so far */
static
void
machine_init
(
void
){
static
void
machine_init
(
void
){
memory
=
malloc
(
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
memory
=
malloc
(
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
regs
=
malloc
(
sizeof
(
int32_t
)
*
NUM_REGS
);
regs
=
malloc
(
sizeof
(
int32_t
)
*
NUM_REGS
);
memset
(
memory
,
0
,
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
//
memset(memory,0,sizeof(int32_t)*MEMORY_SIZE);
memset
(
regs
,
0
,
sizeof
(
int32_t
)
*
NUM_REGS
);
//
memset(regs,0,sizeof(int32_t)*NUM_REGS);
count
=
0
;
count
=
0
;
}
}
...
@@ -226,7 +226,7 @@ int execute(const unsigned int progLength, const int cycles, int32_t * res){
...
@@ -226,7 +226,7 @@ int execute(const unsigned int progLength, const int cycles, int32_t * res){
unsigned
int
cyclesExecuted
=
0
;
unsigned
int
cyclesExecuted
=
0
;
while
(
cycles
>
0
?
cyclesExecuted
<
(
unsigned
int
)
cycles
:
true
){
while
(
cycles
>
0
?
cyclesExecuted
<
(
unsigned
int
)
cycles
:
true
){
cyclesExecuted
++
;
cyclesExecuted
++
;
if
(
pc
<
0
||
pc
>=
(
int
)
progLength
){
if
(
pc
>=
(
int
)
progLength
){
/* will cause an error but that is not a bug and
/* will cause an error but that is not a bug and
* and indeed is what the VM is supposed to do if the pc becomes
* and indeed is what the VM is supposed to do if the pc becomes
* negative, since in this case the program's execution finishes
* negative, since in this case the program's execution finishes
...
...
This diff is collapsed.
Click to expand it.
src/pocs/poc4.s
+
1
−
0
View file @
aceca5c0
pw.println
("
RET
R31
");
\ No newline at end of file
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