Commit 53a28a26 authored by Lev Walkin's avatar Lev Walkin

empty information object sets are OK

parent d8e07c5f
...@@ -2803,8 +2803,14 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob ...@@ -2803,8 +2803,14 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob
} }
} }
if(constraining_column < 0) { if(constraining_column < 0) {
FATAL("Can not find referenced object class column %s\n", cfield); if(opt_ioc->ioct->rows == 0) {
return -1; OUT("0");
return 0;
} else {
FATAL("Can not find referenced object class %s column %s\n",
asn1p_ref_string(objset_ref), cfield);
return -1;
}
} }
if(expr->meta_type != AMT_TYPEREF if(expr->meta_type != AMT_TYPEREF
......
#include "asn1fix_internal.h" #include "asn1fix_internal.h"
#include "asn1fix_cws.h" #include "asn1fix_cws.h"
const char *asn1p_constraint_string(const asn1p_constraint_t *);
static int _asn1f_parse_class_object_data(arg_t *, asn1p_expr_t *eclass, static int _asn1f_parse_class_object_data(arg_t *, asn1p_expr_t *eclass,
struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax, struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax,
const uint8_t *buf, const uint8_t *bend, const uint8_t *buf, const uint8_t *bend,
...@@ -82,26 +84,22 @@ struct parse_object_key { ...@@ -82,26 +84,22 @@ struct parse_object_key {
*/ */
static int static int
_asn1f_add_unique_row(arg_t *arg, asn1p_expr_t *expr, asn1p_ioc_row_t *row) { _asn1f_add_unique_row(arg_t *arg, asn1p_expr_t *expr, asn1p_ioc_row_t *row) {
assert(expr->ioc_table);
if(expr->ioc_table == NULL) { /* Look for duplicates */
expr->ioc_table = asn1p_ioc_table_new(); switch(_asn1f_is_ioc_row_duplicate(expr->ioc_table, row)) {
} else { case -1:
/* Look for duplicates */ DEBUG("Found Information Object Duplicate in %s", expr->Identifier,
expr->_lineno);
switch(_asn1f_is_ioc_row_duplicate(expr->ioc_table, row)) { return -1;
case -1: case 0:
DEBUG("Found Information Object Duplicate in %s", expr->Identifier, /* Not a duplicate */
expr->_lineno); break;
return -1; case 1:
case 0: /* Proper duplicate detected; ignore */
/* Not a duplicate */ asn1p_ioc_row_delete(row);
break; return 0;
case 1:
/* Proper duplicate detected; ignore */
asn1p_ioc_row_delete(row);
return 0;
} }
}
asn1p_ioc_table_add(expr->ioc_table, row); asn1p_ioc_table_add(expr->ioc_table, row);
...@@ -180,27 +178,28 @@ _asn1f_foreach_unparsed_union(const asn1p_constraint_t *ct_union, ...@@ -180,27 +178,28 @@ _asn1f_foreach_unparsed_union(const asn1p_constraint_t *ct_union,
} }
static int static int
_asn1f_foreach_unparsed(const asn1p_constraint_t *ct, _asn1f_foreach_unparsed(arg_t *arg, const asn1p_constraint_t *ct,
int (*process)(const uint8_t *buf, size_t size, int (*process)(const uint8_t *buf, size_t size,
void *key), void *key),
void *key) { void *key) {
if(!ct) return -1; if(!ct) return -1;
if(ct->type == ACT_CA_UNI) {
switch(ct->type) {
default:
DEBUG("Constraint %s is of unknown type for CWS",
asn1p_constraint_string(ct));
return -1;
case ACT_EL_EXT: /* ... */
return 0;
case ACT_CA_UNI: /* | */
return _asn1f_foreach_unparsed_union(ct, process, key); return _asn1f_foreach_unparsed_union(ct, process, key);
case ACT_CA_CSV: /* , */
break;
} }
if(ct->type != ACT_CA_CSV) return -1;
for(size_t i = 0; i < ct->el_count; i++) { for(size_t i = 0; i < ct->el_count; i++) {
const asn1p_constraint_t *ct1 = ct->elements[i]; const asn1p_constraint_t *ct1 = ct->elements[i];
switch(ct1->type) { if(_asn1f_foreach_unparsed(arg, ct1, process, key) != 0) {
case ACT_EL_EXT:
break;
case ACT_CA_UNI:
if(_asn1f_foreach_unparsed_union(ct1, process, key) != 0) {
return -1;
}
break;
default:
return -1; return -1;
} }
} }
...@@ -209,8 +208,9 @@ _asn1f_foreach_unparsed(const asn1p_constraint_t *ct, ...@@ -209,8 +208,9 @@ _asn1f_foreach_unparsed(const asn1p_constraint_t *ct,
} }
static int static int
_asn1f_constraint_looks_like_object_set(const asn1p_constraint_t *ct) { _asn1f_constraint_looks_like_object_set(arg_t *arg,
return 0 == _asn1f_foreach_unparsed(ct, NULL, NULL); const asn1p_constraint_t *ct) {
return 0 == _asn1f_foreach_unparsed(arg, ct, NULL, NULL);
} }
int int
...@@ -232,7 +232,7 @@ asn1f_parse_class_object(arg_t *arg) { ...@@ -232,7 +232,7 @@ asn1f_parse_class_object(arg_t *arg) {
} else if(expr->value && expr->value->type == ATV_UNPARSED) { } else if(expr->value && expr->value->type == ATV_UNPARSED) {
source = FROM_VALUE; source = FROM_VALUE;
} else if(!expr->value) { } else if(!expr->value) {
if(_asn1f_constraint_looks_like_object_set(expr->constraints)) { if(_asn1f_constraint_looks_like_object_set(arg, expr->constraints)) {
source = FROM_CONSTRAINT; source = FROM_CONSTRAINT;
} else { } else {
return 0; return 0;
...@@ -267,6 +267,14 @@ asn1f_parse_class_object(arg_t *arg) { ...@@ -267,6 +267,14 @@ asn1f_parse_class_object(arg_t *arg) {
.sequence = 0 .sequence = 0
}; };
if(!expr->ioc_table) {
expr->ioc_table = asn1p_ioc_table_new();
}
if(!eclass->ioc_table) {
eclass->ioc_table = asn1p_ioc_table_new();
}
switch(source) { switch(source) {
case FROM_VALUE: case FROM_VALUE:
if(_asn1f_parse_object_cb(expr->value->value.string.buf + 1, if(_asn1f_parse_object_cb(expr->value->value.string.buf + 1,
...@@ -276,8 +284,8 @@ asn1f_parse_class_object(arg_t *arg) { ...@@ -276,8 +284,8 @@ asn1f_parse_class_object(arg_t *arg) {
} }
break; break;
case FROM_CONSTRAINT: case FROM_CONSTRAINT:
if(_asn1f_foreach_unparsed(expr->constraints, _asn1f_parse_object_cb, if(_asn1f_foreach_unparsed(arg, expr->constraints,
&key) _asn1f_parse_object_cb, &key)
!= 0) { != 0) {
return -1; return -1;
} }
......

-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .145
ModuleEmptyInformationObjectSet
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 145 }
DEFINITIONS ::=
BEGIN
Frame ::= SEQUENCE {
ident TYPE-IDENTIFIER.&id({FrameTypes}),
value TYPE-IDENTIFIER.&Type({FrameTypes}{@ident})
}
FrameTypes TYPE-IDENTIFIER ::= { ... }
END
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