Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmp_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
0356fd7e
Commit
0356fd7e
authored
1 year ago
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Update round trip fuzz target test
parent
388dd275
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!32
Add fuzzing testing setup
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/fuzz/fuzz_round_trip.c
+14
-8
14 additions, 8 deletions
test/fuzz/fuzz_round_trip.c
with
14 additions
and
8 deletions
test/fuzz/fuzz_round_trip.c
+
14
−
8
View file @
0356fd7e
...
...
@@ -89,8 +89,11 @@ static uint32_t chunk_round_trip(void *data, uint32_t data_size,
if
(
use_decmp_buf
)
decmp_data
=
TEST_malloc
(
data_size
);
if
(
use_decmp_up_model
)
if
(
use_decmp_up_model
)
{
up_model_decmp
=
TEST_malloc
(
data_size
);
if
(
!
model_mode_is_used
(
cmp_par
->
cmp_mode
))
memset
(
up_model_decmp
,
0
,
data_size
);
/* up_model is not used */
}
decmp_size
=
decompress_cmp_entiy
((
struct
cmp_entity
*
)
cmp_data
,
model_cpy
,
up_model_decmp
,
decmp_data
);
...
...
@@ -144,9 +147,18 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
}
FUZZ_ASSERT
(
size
<=
UINT32_MAX
);
/* 1/2 of the cases we use a updated model buffer */
/* generate compression parameters */
FUZZ_dataProducer_cmp_par
(
producer
,
&
cmp_par
);
cmp_par
.
lossy_par
=
0
;
/*TODO: implement lossy */
if
(
FUZZ_dataProducer_uint32Range
(
producer
,
0
,
1
))
cmp_par_ptr
=
&
cmp_par
;
/* 1/2 of the cases we use a updated model buffer */
if
(
FUZZ_dataProducer_uint32Range
(
producer
,
0
,
1
))
{
up_model
=
FUZZ_malloc
(
size
);
if
(
!
model_mode_is_used
(
cmp_par
.
cmp_mode
))
memset
(
up_model
,
0
,
size
);
/* up_model is not used */
}
cmp_size_bound
=
compress_chunk_cmp_size_bound
(
src
,
size
);
if
(
cmp_is_error
(
cmp_size_bound
))
...
...
@@ -154,12 +166,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
cmp_data_capacity
=
FUZZ_dataProducer_uint32Range
(
producer
,
0
,
cmp_size_bound
+
(
uint32_t
)
size
);
cmp_data
=
(
uint32_t
*
)
FUZZ_malloc
(
cmp_data_capacity
);
FUZZ_dataProducer_cmp_par
(
producer
,
&
cmp_par
);
cmp_par
.
lossy_par
=
0
;
/*TODO: implement lossy */
if
(
FUZZ_dataProducer_uint32Range
(
producer
,
0
,
1
))
cmp_par_ptr
=
&
cmp_par
;
use_decmp_buf
=
FUZZ_dataProducer_int32Range
(
producer
,
0
,
1
);
use_decmp_up_model
=
FUZZ_dataProducer_int32Range
(
producer
,
0
,
1
);
...
...
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