From 1b1e30a65b55ab05fbc49b01512ec8a0f33b0767 Mon Sep 17 00:00:00 2001 From: Mouse Date: Sat, 13 Jan 2024 23:30:56 -0500 Subject: [PATCH] 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. --- skeletons/NativeInteger_rfill.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/skeletons/NativeInteger_rfill.c b/skeletons/NativeInteger_rfill.c index 0e2cee8e4..fddd14968 100644 --- a/skeletons/NativeInteger_rfill.c +++ b/skeletons/NativeInteger_rfill.c @@ -63,8 +63,10 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, 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(!constraints || !constraints->per_constraints) + constraints = &td->encoding_constraints; + const asn_per_constraints_t *ct; ct = constraints ? constraints->per_constraints : 0; @@ -74,6 +76,8 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, ct->value.upper_bound); } } +#else + if(!constraints) constraints = &td->encoding_constraints; #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ }