Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swen90006-a2-2019
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Toby Murray
swen90006-a2-2019
Merge requests
!12
Vuln jay
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Vuln jay
jparikh/swen90006-a2-2019:vuln-jay
into
master
Overview
0
Commits
51
Pipelines
0
Changes
14
Closed
Jay Parikh
requested to merge
jparikh/swen90006-a2-2019:vuln-jay
into
master
5 years ago
Overview
0
Commits
51
Pipelines
0
Changes
14
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
1012da20
51 commits,
5 years ago
14 files
+
398
−
59
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
14
Search (e.g. *.vue) (Ctrl+P)
fuzzer/Command.java
0 → 100644
+
56
−
0
Options
import
java.security.SecureRandom
;
public
class
Command
{
private
Instruction
instruction
;
private
String
[]
arguments
;
private
static
final
int
COMMAND_LENGTH
=
1022
;
private
static
final
SecureRandom
rand
=
new
SecureRandom
();
Command
(
Instruction
instruction
,
String
[]
arguments
)
{
this
.
instruction
=
instruction
;
this
.
arguments
=
arguments
;
}
public
String
toString
()
{
String
argumentString
=
""
;
for
(
String
arg
:
arguments
)
{
argumentString
+=
" "
+
arg
;
}
String
command
=
instruction
.
getOpcode
()
+
argumentString
;
if
(
command
.
length
()
>
Command
.
COMMAND_LENGTH
)
{
return
command
.
substring
(
0
,
Command
.
COMMAND_LENGTH
);
}
return
command
;
}
public
Instruction
getInstruction
()
{
return
this
.
instruction
;
}
public
String
[]
getArguments
()
{
return
this
.
arguments
;
}
private
static
String
randomString
(
int
length
)
{
String
upper
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
String
lower
=
upper
.
toLowerCase
();
String
digits
=
"0123456789"
;
char
[]
symbols
=
(
upper
+
lower
+
digits
).
toCharArray
();
char
[]
buffer
=
new
char
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
buffer
[
i
]
=
symbols
[
rand
.
nextInt
(
symbols
.
length
)];
}
return
new
String
(
buffer
);
}
public
static
Command
randomCommand
()
{
Instruction
instruction
=
Instruction
.
randomInstruction
();
String
[]
arguments
=
new
String
[
instruction
.
getOperands
().
length
];
for
(
int
j
=
0
;
j
<
arguments
.
length
;
j
++)
{
arguments
[
j
]
=
Command
.
randomString
(
rand
.
nextInt
((
COMMAND_LENGTH
/
3
)
-
1
)
+
1
);
}
return
new
Command
(
instruction
,
arguments
);
}
}
Loading