test whether bit string values are identifiers
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1143 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/libasn1fix/asn1fix_bitstring.c b/libasn1fix/asn1fix_bitstring.c
index 8297f27..f8adc75 100644
--- a/libasn1fix/asn1fix_bitstring.c
+++ b/libasn1fix/asn1fix_bitstring.c
@@ -1,6 +1,7 @@
#include "asn1fix_internal.h"
-int asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype);
+static int asn1f_fix_bit_string_type(arg_t *arg);
+static int asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype);
static void asn1f_BS_remove_trailing_zero_bits(asn1p_value_t *value);
static int asn1f_BS_unparsed_convert(arg_t *arg, asn1p_value_t *value, asn1p_expr_t *ttype);
@@ -22,10 +23,33 @@
}
}
+ if(expr->meta_type == AMT_TYPE
+ && expr->expr_type == ASN_BASIC_BIT_STRING) {
+ ret = asn1f_fix_bit_string_type(arg);
+ RET2RVAL(ret, r_value);
+ }
+
return r_value;
}
-int
+static int
+asn1f_fix_bit_string_type(arg_t *arg) {
+ asn1p_expr_t *expr = arg->expr;
+ asn1p_expr_t *v;
+
+ TQ_FOR(v, &(expr->members), next) {
+ if(v->expr_type != A1TC_UNIVERVAL) {
+ FATAL("BIT STRING value at line %d "
+ "is not an identifier",
+ v->_lineno);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int
asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype) {
asn1p_expr_t *expr = arg->expr;
int r_value = 0;
diff --git a/tests/109-bit-string-SE.asn1 b/tests/109-bit-string-SE.asn1
new file mode 100644
index 0000000..a07f7a1
--- /dev/null
+++ b/tests/109-bit-string-SE.asn1
@@ -0,0 +1,16 @@
+
+-- SE: Semantic error
+
+-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
+-- .spelio.software.asn1c.test (9363.1.5.1)
+-- .109
+
+ModuleBitStringExtensibility
+ { iso org(3) dod(6) internet (1) private(4) enterprise(1)
+ spelio(9363) software(1) asn1c(5) test(1) 109 }
+ DEFINITIONS ::=
+BEGIN
+
+ T ::= BIT STRING { one(1), ... }
+
+END