Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
53a28a26
Commit
53a28a26
authored
Aug 23, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
empty information object sets are OK
parent
d8e07c5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
37 deletions
+72
-37
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+8
-2
libasn1fix/asn1fix_cws.c
libasn1fix/asn1fix_cws.c
+43
-35
tests/tests-asn1c-compiler/145-empty-information-object-set-OK.asn1
...s-asn1c-compiler/145-empty-information-object-set-OK.asn1
+21
-0
No files found.
libasn1compiler/asn1c_C.c
View file @
53a28a26
...
...
@@ -2803,8 +2803,14 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob
}
}
if
(
constraining_column
<
0
)
{
FATAL
(
"Can not find referenced object class column %s
\n
"
,
cfield
);
return
-
1
;
if
(
opt_ioc
->
ioct
->
rows
==
0
)
{
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
...
...
libasn1fix/asn1fix_cws.c
View file @
53a28a26
#include "asn1fix_internal.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
,
struct
asn1p_ioc_row_s
*
row
,
asn1p_wsyntx_t
*
syntax
,
const
uint8_t
*
buf
,
const
uint8_t
*
bend
,
...
...
@@ -82,26 +84,22 @@ struct parse_object_key {
*/
static
int
_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
)
{
expr
->
ioc_table
=
asn1p_ioc_table_new
();
}
else
{
/* Look for duplicates */
switch
(
_asn1f_is_ioc_row_duplicate
(
expr
->
ioc_table
,
row
))
{
case
-
1
:
DEBUG
(
"Found Information Object Duplicate in %s"
,
expr
->
Identifier
,
expr
->
_lineno
);
return
-
1
;
case
0
:
/* Not a duplicate */
break
;
case
1
:
/* Proper duplicate detected; ignore */
asn1p_ioc_row_delete
(
row
);
return
0
;
/* Look for duplicates */
switch
(
_asn1f_is_ioc_row_duplicate
(
expr
->
ioc_table
,
row
))
{
case
-
1
:
DEBUG
(
"Found Information Object Duplicate in %s"
,
expr
->
Identifier
,
expr
->
_lineno
);
return
-
1
;
case
0
:
/* Not a duplicate */
break
;
case
1
:
/* Proper duplicate detected; ignore */
asn1p_ioc_row_delete
(
row
);
return
0
;
}
}
asn1p_ioc_table_add
(
expr
->
ioc_table
,
row
);
...
...
@@ -180,27 +178,28 @@ _asn1f_foreach_unparsed_union(const asn1p_constraint_t *ct_union,
}
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
,
void
*
key
),
void
*
key
)
{
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
);
case
ACT_CA_CSV
:
/* , */
break
;
}
if
(
ct
->
type
!=
ACT_CA_CSV
)
return
-
1
;
for
(
size_t
i
=
0
;
i
<
ct
->
el_count
;
i
++
)
{
const
asn1p_constraint_t
*
ct1
=
ct
->
elements
[
i
];
switch
(
ct1
->
type
)
{
case
ACT_EL_EXT
:
break
;
case
ACT_CA_UNI
:
if
(
_asn1f_foreach_unparsed_union
(
ct1
,
process
,
key
)
!=
0
)
{
return
-
1
;
}
break
;
default:
if
(
_asn1f_foreach_unparsed
(
arg
,
ct1
,
process
,
key
)
!=
0
)
{
return
-
1
;
}
}
...
...
@@ -209,8 +208,9 @@ _asn1f_foreach_unparsed(const asn1p_constraint_t *ct,
}
static
int
_asn1f_constraint_looks_like_object_set
(
const
asn1p_constraint_t
*
ct
)
{
return
0
==
_asn1f_foreach_unparsed
(
ct
,
NULL
,
NULL
);
_asn1f_constraint_looks_like_object_set
(
arg_t
*
arg
,
const
asn1p_constraint_t
*
ct
)
{
return
0
==
_asn1f_foreach_unparsed
(
arg
,
ct
,
NULL
,
NULL
);
}
int
...
...
@@ -232,7 +232,7 @@ asn1f_parse_class_object(arg_t *arg) {
}
else
if
(
expr
->
value
&&
expr
->
value
->
type
==
ATV_UNPARSED
)
{
source
=
FROM_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
;
}
else
{
return
0
;
...
...
@@ -267,6 +267,14 @@ asn1f_parse_class_object(arg_t *arg) {
.
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
)
{
case
FROM_VALUE
:
if
(
_asn1f_parse_object_cb
(
expr
->
value
->
value
.
string
.
buf
+
1
,
...
...
@@ -276,8 +284,8 @@ asn1f_parse_class_object(arg_t *arg) {
}
break
;
case
FROM_CONSTRAINT
:
if
(
_asn1f_foreach_unparsed
(
expr
->
constraints
,
_asn1f_parse_object_cb
,
&
key
)
if
(
_asn1f_foreach_unparsed
(
arg
,
expr
->
constraints
,
_asn1f_parse_object_cb
,
&
key
)
!=
0
)
{
return
-
1
;
}
...
...
tests/tests-asn1c-compiler/145-empty-information-object-set-OK.asn1
0 → 100755
View file @
53a28a26
-- 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment