Merge PR99 and its fixes to support parsing Information Object and Information Object Set
This is a collection of works :
1. Based on @zhanglei002's pull request 99.
2. A fix by @AuthenticEshkinKot and merged by @mouse07410 at
commit 2c8d366bbe1fc4e4c041e9b0eb9779f8a42d754b of https://github.com/mouse07410/asn1c
to support parsing of Information Object and Information Object Set
3. A fix by @Uri Blumenthal in asn1fix_derefv.c at :
commit ec0ade4f87c807e763e3f35fc5466adb6dda3473 of https://github.com/mouse07410/asn1c
to solve crash on asn1p_value_free().
4. My pull request 18 to @mouse07410's https://github.com/mouse07410/asn1c to solve
problems found during parsing ASN.1 modules of S1AP, RANAP and J2735-201603.
5. My pull request 22 to @mouse07410's https://github.com/mouse07410/asn1c to solve issue 147
and to solve the problem during parsing ASN.1 module of NBAP.
6. My pull request 23 to @mouse07410's https://github.com/mouse07410/asn1c to fix memory leakage
introduced in aforementioned commits.
Most code changes are the same as pull request 153 to this repository.
7. A fix of my bug in item 6 which result asn1c crash, fixed by @mouse07410.
diff --git a/libasn1fix/asn1fix_param.c b/libasn1fix/asn1fix_param.c
index f8e3a2e..fe98081 100644
--- a/libasn1fix/asn1fix_param.c
+++ b/libasn1fix/asn1fix_param.c
@@ -18,6 +18,7 @@
resolver_arg_t rarg; /* resolver argument */
asn1p_expr_t *exc; /* expr clone */
asn1p_expr_t *rpc; /* rhs_pspecs clone */
+ asn1p_expr_t *m; /* expr members */
void *p;
struct asn1p_pspec_s *pspec;
int npspecs;
@@ -69,6 +70,17 @@
pspec->my_clone = exc;
exc->spec_index = npspecs;
+ /* Passing arguments to members and type references */
+ exc->rhs_pspecs = expr->rhs_pspecs ? expr->rhs_pspecs : rhs_pspecs;
+ if(exc->rhs_pspecs)
+ exc->rhs_pspecs->ref_cnt++;
+
+ TQ_FOR(m, &exc->members, next) {
+ m->rhs_pspecs = exc->rhs_pspecs;
+ if (exc->rhs_pspecs)
+ exc->rhs_pspecs->ref_cnt++;
+ }
+
DEBUG("Forked new parameterization for %s", expr->Identifier);
/* Commit */
@@ -86,7 +98,15 @@
if(ac == bc) continue;
if(ac->meta_type != bc->meta_type) break;
if(ac->expr_type != bc->expr_type) break;
-
+ /* Maybe different object sets */
+ if(ac->constraints && bc->constraints
+ && ac->constraints->containedSubtype
+ && bc->constraints->containedSubtype
+ && ac->constraints->containedSubtype->type == ATV_REFERENCED
+ && bc->constraints->containedSubtype->type == ATV_REFERENCED
+ && strcmp(ac->constraints->containedSubtype->value.reference->components[0].name,
+ bc->constraints->containedSubtype->value.reference->components[0].name))
+ break;
if(!ac->reference && !bc->reference)
continue;