Commit fac2e94b authored by Lev Walkin's avatar Lev Walkin

new UTF8String_length() semantics

parent 98d0b5fd
......@@ -45,8 +45,9 @@ BEGIN
SIZE-and-FROM ::= PER-Visible (SIZE(1..4) ^ FROM("ABCD"))
Neither-SIZE-nor-FROM ::= PER-Visible (SIZE(1..4) | FROM("ABCD",...))
Utf8-3 ::= Utf8-2 (FROM("A".."Z"|"a".."z"))
Utf8-2 ::= Utf8-1 (SIZE(1..2))
Utf8-4 ::= UTF8String (FROM("A".."Z"|"a".."z")) -- Alphabet
Utf8-3 ::= Utf8-2 (FROM("A".."Z"|"a".."z")) -- Alphabet and size
Utf8-2 ::= Utf8-1 (SIZE(1..2)) -- Size
Utf8-1 ::= UTF8String
VisibleIdentifier ::= Identifier
......
......@@ -2346,8 +2346,13 @@ Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
size = UTF8String_length(st, td->name, app_errlog, app_key);
if(size == (size_t)-1) return -1;
size = UTF8String_length(st);
if(size < 0) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: UTF-8: broken encoding (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if((size >= 1 && size <= 2)
&& !check_permitted_alphabet_12(sptr)) {
......@@ -2476,8 +2481,13 @@ Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
size = UTF8String_length(st, td->name, app_errlog, app_key);
if(size == (size_t)-1) return -1;
size = UTF8String_length(st);
if(size < 0) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: UTF-8: broken encoding (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if((size >= 1 && size <= 2)) {
/* Constraint check succeeded */
......
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