Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathis Rosenhauer
libaec
Commits
6f2d841a
Commit
6f2d841a
authored
Sep 04, 2018
by
Mathis Rosenhauer
Browse files
Use fuzzer data on both encoder and decoder (fixes #7)
parent
031a9990
Changes
1
Hide whitespace changes
Inline
Side-by-side
fuzzing/fuzz_target.cc
View file @
6f2d841a
...
@@ -12,6 +12,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
...
@@ -12,6 +12,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
strm
.
bits_per_sample
=
(
Data
[
0
]
&
0x1f
)
|
1
;
strm
.
bits_per_sample
=
(
Data
[
0
]
&
0x1f
)
|
1
;
strm
.
block_size
=
8
<<
(
Data
[
1
]
&
3
);
strm
.
block_size
=
8
<<
(
Data
[
1
]
&
3
);
strm
.
rsi
=
2
;
strm
.
rsi
=
2
;
strm
.
flags
=
AEC_DATA_PREPROCESS
;
strm
.
flags
=
AEC_DATA_PREPROCESS
;
if
(
Data
[
1
]
&
0x80
)
if
(
Data
[
1
]
&
0x80
)
strm
.
flags
|=
AEC_DATA_MSB
;
strm
.
flags
|=
AEC_DATA_MSB
;
...
@@ -21,14 +22,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
...
@@ -21,14 +22,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
strm
.
bits_per_sample
>
16
&&
strm
.
bits_per_sample
>
16
&&
Data
[
1
]
&
0x10
)
Data
[
1
]
&
0x10
)
strm
.
flags
|=
AEC_DATA_3BYTE
;
strm
.
flags
|=
AEC_DATA_3BYTE
;
// Decode data
strm
.
next_in
=
(
unsigned
char
*
)(
Data
+
2
);
strm
.
avail_in
=
Size
-
2
;
strm
.
next_out
=
dest
;
strm
.
avail_out
=
(
Size
-
2
)
*
4
;
aec_buffer_encode
(
&
strm
);
// Encode data
strm
.
next_in
=
(
unsigned
char
*
)(
Data
+
2
);
strm
.
next_in
=
(
unsigned
char
*
)(
Data
+
2
);
strm
.
avail_in
=
Size
-
2
;
strm
.
avail_in
=
Size
-
2
;
strm
.
next_out
=
dest
;
strm
.
next_out
=
dest
;
strm
.
avail_out
=
(
Size
-
2
)
*
4
;
strm
.
avail_out
=
(
Size
-
2
)
*
4
;
if
(
Data
[
1
]
&
0x20
)
aec_buffer_decode
(
&
strm
);
aec_buffer_encode
(
&
strm
);
else
aec_buffer_decode
(
&
strm
);
free
(
dest
);
free
(
dest
);
return
0
;
return
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