Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
d2a73606
Commit
d2a73606
authored
Oct 21, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bound the size of SEQUENCE OF and SET OF random generator
parent
62155df0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
5 deletions
+50
-5
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+20
-5
tests/tests-randomized/Makefile.am
tests/tests-randomized/Makefile.am
+1
-0
tests/tests-randomized/bundles/17-SEQUENCE-OF-bundle.txt
tests/tests-randomized/bundles/17-SEQUENCE-OF-bundle.txt
+29
-0
No files found.
skeletons/constr_SET_OF.c
View file @
d2a73606
...
...
@@ -981,7 +981,7 @@ asn_TYPE_operation_t asn_OP_SET_OF = {
asn_random_fill_result_t
SET_OF_random_fill
(
const
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
asn_encoding_constraints_t
*
constr
,
const
asn_encoding_constraints_t
*
constr
aints
,
size_t
max_length
)
{
const
asn_SET_OF_specifics_t
*
specs
=
(
const
asn_SET_OF_specifics_t
*
)
td
->
specifics
;
...
...
@@ -990,12 +990,12 @@ SET_OF_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
asn_random_fill_result_t
result_skipped
=
{
ARFILL_SKIPPED
,
0
};
const
asn_TYPE_member_t
*
elm
=
td
->
elements
;
void
*
st
=
*
sptr
;
long
slb
=
0
;
/* Lower size bound */
long
sub
=
5
;
/* Upper size bound */
size_t
rnd_len
;
if
(
max_length
==
0
)
return
result_skipped
;
(
void
)
constr
;
if
(
st
==
NULL
)
{
st
=
(
*
sptr
=
CALLOC
(
1
,
specs
->
struct_size
));
if
(
st
==
NULL
)
{
...
...
@@ -1003,13 +1003,28 @@ SET_OF_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
}
}
rnd_len
=
asn_random_between
(
0
,
5
);
if
(
!
constraints
||
!
constraints
->
per_constraints
)
constraints
=
&
td
->
encoding_constraints
;
if
(
constraints
->
per_constraints
)
{
const
asn_per_constraint_t
*
pc
=
&
constraints
->
per_constraints
->
size
;
if
(
pc
->
flags
&
APC_SEMI_CONSTRAINED
)
{
slb
=
pc
->
lower_bound
;
sub
=
pc
->
lower_bound
+
5
;
}
else
if
(
pc
->
flags
&
APC_CONSTRAINED
)
{
slb
=
pc
->
lower_bound
;
sub
=
pc
->
upper_bound
;
if
(
sub
-
slb
>
5
)
sub
=
slb
+
5
;
}
}
rnd_len
=
asn_random_between
(
slb
,
sub
);
for
(;
rnd_len
>
0
;
rnd_len
--
)
{
asn_anonymous_set_
*
list
=
_A_SET_FROM_VOID
(
st
);
void
*
ptr
=
0
;
asn_random_fill_result_t
tmpres
=
elm
->
type
->
op
->
random_fill
(
elm
->
type
,
&
ptr
,
&
elm
->
encoding_constraints
,
max_length
>
res_ok
.
length
?
max_length
-
res_ok
.
length
:
0
);
(
max_length
>
res_ok
.
length
?
max_length
-
res_ok
.
length
:
0
)
/
rnd_len
);
switch
(
tmpres
.
code
)
{
case
ARFILL_OK
:
ASN_SET_ADD
(
list
,
ptr
);
...
...
tests/tests-randomized/Makefile.am
View file @
d2a73606
...
...
@@ -41,6 +41,7 @@ TESTS += bundles/13-UTCTime-bundle.txt
TESTS
+=
bundles/14-GeneralizedTime-bundle.txt
TESTS
+=
bundles/15-CHOICE-bundle.txt
TESTS
+=
bundles/16-SEQUENCE-bundle.txt
TESTS
+=
bundles/17-SEQUENCE-OF-bundle.txt
EXTRA_DIST
=
\
random-test-driver.c
\
...
...
tests/tests-randomized/bundles/17-SEQUENCE-OF-bundle.txt
0 → 100644
View file @
d2a73606
SEQUENCE OF NULL
SEQUENCE (SIZE(0)) OF NULL
SEQUENCE (SIZE(1)) OF NULL
SEQUENCE (SIZE(0..2)) OF NULL
SEQUENCE (SIZE(1..2)) OF NULL
SEQUENCE (SIZE(1..MAX)) OF NULL
SEQUENCE OF BOOLEAN
SEQUENCE (SIZE(0)) OF BOOLEAN
SEQUENCE (SIZE(1)) OF BOOLEAN
SEQUENCE (SIZE(0..2)) OF BOOLEAN
SEQUENCE (SIZE(1..2)) OF BOOLEAN
SEQUENCE (SIZE(1..MAX)) OF BOOLEAN
SEQUENCE OF PrintableString (SIZE(1))
SEQUENCE (SIZE(0)) OF PrintableString (SIZE(1))
SEQUENCE (SIZE(1)) OF PrintableString (SIZE(1))
SEQUENCE (SIZE(0..2)) OF PrintableString (SIZE(1))
SEQUENCE (SIZE(1..2)) OF PrintableString (SIZE(1))
SEQUENCE (SIZE(1..MAX)) OF PrintableString (SIZE(1))
SEQUENCE OF PrintableString (FROM("A".."Z"))
SEQUENCE (SIZE(0)) OF PrintableString (FROM("A".."Z"))
SEQUENCE (SIZE(1)) OF PrintableString (FROM("A".."Z"))
SEQUENCE (SIZE(0..2)) OF PrintableString (FROM("A".."Z"))
SEQUENCE (SIZE(1..2)) OF PrintableString (FROM("A".."Z"))
SEQUENCE (SIZE(1..MAX)) OF PrintableString (FROM("A".."Z"))
SEQUENCE OF PrintableString (FROM("A".."Z"))
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