From e5086e3f92072cfb8520dfb852478d3883d30bd1 Mon Sep 17 00:00:00 2001 From: Lev Walkin Date: Mon, 10 Feb 2014 11:00:51 -0800 Subject: [PATCH] extensibility shall not change the type from wide to narrow --- libasn1compiler/asn1c_constraint.c | 2 +- libasn1compiler/asn1c_misc.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libasn1compiler/asn1c_constraint.c b/libasn1compiler/asn1c_constraint.c index 822c6cec8..bdabfff04 100644 --- a/libasn1compiler/asn1c_constraint.c +++ b/libasn1compiler/asn1c_constraint.c @@ -705,7 +705,7 @@ native_long_sign(asn1cnst_range_t *r) { && r->left.value >= 0 && r->right.type == ARE_VALUE && r->right.value > 2147483647 - && (unsigned long)r->right.value <= 4294967295UL) { + && r->right.value <= 4294967295UL) { if(r->el_count == 0 && r->left.value == 0 && r->right.value == 4294967295UL) diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index 6ffd1f0a3..f74fbeb2a 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -359,9 +359,13 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) { */ range = asn1constraint_compute_PER_range(expr->expr_type, expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0); + if(!range + /* Commenting out + || range->extensible + * because this may or may not indicate wide type. + */ || range->empty_constraint - || range->extensible || range->incompatible || range->not_PER_visible ) { @@ -379,7 +383,7 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) { && left.value >= 0 && right.type == ARE_VALUE && right.value > 2147483647 - && (unsigned long)right.value <= 4294967295UL) + && right.value <= 4294967295UL) return FL_FITS_UNSIGN;