mirror of https://gerrit.osmocom.org/asn1c
fix consrtaint propagation for random_fill
This commit is contained in:
parent
d14802fa0f
commit
6bc5696f52
|
@ -571,7 +571,8 @@ BIT_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
|
|||
/* Figure out how far we should go */
|
||||
rnd_bits = lengths[asn_random_between(
|
||||
0, sizeof(lengths) / sizeof(lengths[0]) - 1)];
|
||||
if(!constraints) constraints = &td->encoding_constraints;
|
||||
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_CONSTRAINED) {
|
||||
|
|
|
@ -406,7 +406,8 @@ BOOLEAN_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
|
|||
}
|
||||
}
|
||||
|
||||
if(!constraints) constraints = &td->encoding_constraints;
|
||||
if(!constraints || !constraints->per_constraints)
|
||||
constraints = &td->encoding_constraints;
|
||||
if(constraints->per_constraints) {
|
||||
const asn_per_constraint_t *pc = &constraints->per_constraints->value;
|
||||
if(pc->flags & APC_CONSTRAINED) {
|
||||
|
|
|
@ -1886,10 +1886,10 @@ OCTET_STRING_random_length_constrained(
|
|||
rnd_len = lengths[asn_random_between(
|
||||
0, sizeof(lengths) / sizeof(lengths[0]) - 1)];
|
||||
|
||||
if(!constraints) constraints = &td->encoding_constraints;
|
||||
if(!constraints || !constraints->per_constraints)
|
||||
constraints = &td->encoding_constraints;
|
||||
if(constraints->per_constraints) {
|
||||
const asn_per_constraint_t *pc =
|
||||
&td->encoding_constraints.per_constraints->size;
|
||||
const asn_per_constraint_t *pc = &constraints->per_constraints->size;
|
||||
if(pc->flags & APC_CONSTRAINED) {
|
||||
long suggested_upper_bound = pc->upper_bound < (ssize_t)max_length
|
||||
? pc->upper_bound
|
||||
|
@ -1977,10 +1977,10 @@ OCTET_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
|
|||
break;
|
||||
}
|
||||
|
||||
if(!constraints) constraints = &td->encoding_constraints;
|
||||
if(!constraints || !constraints->per_constraints)
|
||||
constraints = &td->encoding_constraints;
|
||||
if(constraints->per_constraints) {
|
||||
const asn_per_constraint_t *pc =
|
||||
&td->encoding_constraints.per_constraints->value;
|
||||
const asn_per_constraint_t *pc = &constraints->per_constraints->value;
|
||||
if(pc->flags & APC_SEMI_CONSTRAINED) {
|
||||
clb = pc->lower_bound;
|
||||
} else if(pc->flags & APC_CONSTRAINED) {
|
||||
|
|
|
@ -7,6 +7,12 @@ SEQUENCE { ..., null NULL OPTIONAL }
|
|||
SEQUENCE { ..., null BOOLEAN }
|
||||
SEQUENCE { ..., null BOOLEAN DEFAULT FALSE }
|
||||
SEQUENCE { ..., null BOOLEAN DEFAULT TRUE }
|
||||
SEQUENCE { str IA5String }
|
||||
SEQUENCE { str IA5String OPTIONAL }
|
||||
SEQUENCE { str IA5String (SIZE(0)) }
|
||||
SEQUENCE { str IA5String (SIZE(0)) OPTIONAL }
|
||||
SEQUENCE { str IA5String (SIZE(1)) }
|
||||
SEQUENCE { str IA5String (SIZE(1)) OPTIONAL }
|
||||
|
||||
SEQUENCE { null NULL }
|
||||
SEQUENCE { null NULL, ... }
|
||||
|
|
Loading…
Reference in New Issue