Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swen90006-a2-2020
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Arman Arethna
swen90006-a2-2020
Commits
c677bd31
Commit
c677bd31
authored
Oct 23, 2020
by
Ewen Smith
Browse files
Options
Downloads
Patches
Plain Diff
Added conditions fo give incorrect vars with instructions
parent
482837bb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
fuzzer/Fuzzer.java
+26
-12
26 additions, 12 deletions
fuzzer/Fuzzer.java
with
26 additions
and
12 deletions
fuzzer/Fuzzer.java
+
26
−
12
View file @
c677bd31
...
...
@@ -202,12 +202,12 @@ public class Fuzzer {
if
(
instructionStack
.
size
()
>=
MAX_STACK
)
{
instructionStack
.
clear
();
}
System
.
out
.
println
(
"stack: "
+
Arrays
.
toString
(
instructionStack
.
toArray
()));
for
(
List
<
Instruction
>
list:
pathwayProb
.
keySet
())
{
String
key
=
list
.
toString
();
String
value
=
pathwayProb
.
get
(
list
).
toString
();
System
.
out
.
println
(
"map: "
+
key
+
" "
+
value
);
}
//
System.out.println("stack: " + Arrays.toString(instructionStack.toArray()));
//
for (List<Instruction> list: pathwayProb.keySet()) {
//
String key = list.toString();
//
String value = pathwayProb.get(list).toString();
//
System.out.println("map: " + key + " " + value);
//
}
}
...
...
@@ -283,8 +283,10 @@ public class Fuzzer {
name
=
" "
+
((
Integer
)
randomRange
(
VAR_MIN
,
VAR_MAX
)).
toString
();
}
else
{
// If incorrect, increase the range to outside +- int31_t
if
(
randomRange
(
0
,
100
)<
50
){
name
=
" "
+
((
Long
)
(
randomRange
(-
1
,
1
)*((
long
)
VAR_MAX
+
(
long
)
randomRange
(
0
,
VAR_MAX
)))).
toString
();
}
}
break
;
case
LOAD:
case
REM:
...
...
@@ -304,22 +306,30 @@ public class Fuzzer {
}
break
;
case
STORE:
// If
not
correct, make up a name not in the list
// If correct, make up a name not in the list
if
(
correct
||
vars
.
size
()
==
0
){
// Make up a name
name
=
generateName
(
longVarNames
);
vars
.
add
(
name
);
}
//
If no variables, return empty string
//
Otherwise get name from exiting, or no name
else
{
if
(
randomRange
(
0
,
100
)<
50
)
{
name
=
vars
.
get
(
randomRange
(
0
,
vars
.
size
()
-
1
));
}
}
name
=
" "
+
name
;
break
;
case
SAVE:
if
(
correct
){
name
=
" "
+
generateName
(
false
)
+
".txt"
;
}
else
{
if
(
randomRange
(
0
,
100
)<
50
)
{
name
=
" "
+
generateName
(
longVarNames
)
+
".txt"
;
}
}
break
;
case
PLUS:
case
SUB:
...
...
@@ -345,7 +355,11 @@ public class Fuzzer {
int
length
;
if
(
longVarName
){
if
(
randomRange
(
0
,
100
)<
50
){
length
=
0
;
}
else
{
length
=
VAR_NAME_LENGTH_MAX
+
100
;
}
}
else
{
// Randomise the length of the string
length
=
rand
.
nextInt
(
VAR_NAME_LENGTH_MAX
);
...
...
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