Unverified Commit 1b1e30a6 authored by Mouse's avatar Mouse Committed by GitHub

Update NativeInteger_rfill.c to respect PER constraints

`NativeInteger_rfill.c` was sometimes ignoring the PER constrains. @lbm98 added a check which was also present in BIT_STRING_rfill.c to respect them.
parent 04cb5446
...@@ -63,8 +63,10 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, ...@@ -63,8 +63,10 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
0, sizeof(variants) / sizeof(variants[0]) - 1)]; 0, sizeof(variants) / sizeof(variants[0]) - 1)];
} }
if(!constraints) constraints = &td->encoding_constraints;
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
if(!constraints || !constraints->per_constraints)
constraints = &td->encoding_constraints;
const asn_per_constraints_t *ct; const asn_per_constraints_t *ct;
ct = constraints ? constraints->per_constraints : 0; ct = constraints ? constraints->per_constraints : 0;
...@@ -74,6 +76,8 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, ...@@ -74,6 +76,8 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
ct->value.upper_bound); ct->value.upper_bound);
} }
} }
#else
if(!constraints) constraints = &td->encoding_constraints;
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment