Skip to content

Commit

Permalink
Update NativeInteger_rfill.c to respect PER constraints
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
mouse07410 authored Jan 14, 2024
1 parent 04cb544 commit 1b1e30a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion skeletons/NativeInteger_rfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) */
}

Expand Down

0 comments on commit 1b1e30a

Please sign in to comment.