-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge PR99 and its fixes to support parsing Information Object and Information Object Set #154
Merge PR99 and its fixes to support parsing Information Object and Information Object Set #154
Conversation
…formation 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 2c8d366 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 ec0ade4 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.
95317cd
to
80fd306
Compare
2383076
to
2d6b8c0
Compare
Excerpt from commit log : Do not generate coverage data for the test C code When compiling tests remove the CODE_COVERAGE_CFLAGS flags from CFLAGS and also add CFLAGS = $(filter-out $(CODE_COVERAGE_CFLAGS), @CFLAGS@) to 'skeleton/Makefile.am' to avoid compilation error in vlm's repository.
Travis CI failed due to weird reason : The log length has exceeded the limit of 4 MB \ (this usually means that the test suite is raising \ the same exception over and over). The job has been terminated A temporary solution is removing `make check` and only perform `make distcheck` to reduce log size.
Thank you! Looking into it. |
@@ -9,7 +9,6 @@ script: | |||
- autoreconf -iv | |||
- ./configure --enable-Werror --enable-code-coverage | |||
- make -j8 | |||
- make check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the problem that prompted this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis CI reports log larger than 4M bytes thus abort
The log length has exceeded the limit of 4 MB (this usually means that the test suite is raising the same exception over and over).
The job has been terminated
This is just a workaround to reduce log size. I am not able to figure out why.
Please feel free to rollback it at your discretion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something like make check 2>&1 | tail - 1000
would work best?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya, good idea.
); | ||
} else { | ||
WARNING("asn1c only be able to parse TypeFieldSpec and FixedTypeValueFieldSpec. Failed when parsing %s at line %d\n", p, arg->expr->_lineno); | ||
free(p); /* bad idea freeing object you refer to later! */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear I understand the comment. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to 11.7 of X.681, Setting's BNF is :
Setting ::= Type | Value | ValueSet | Object | ObjectSet
Currently only Type (A1TC_CLASSFIELD_TFS) and Value (A1TC_CLASSFIELD_FTVFS) are implemented.
Sorry for my bad English wording, please feel free to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refer to pr 22 to mouse07410's repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh.
About the comment : /* bad idea freeing object you refer to later! */
.
The story is : when I sent pr 23 to @mouse07410's repository, i.e. item 6 in my description, I made a mistake that put free(p)
before WARNING(...)
which cause asn1c
crash since the warning message use content pointed by pointer p
.
@mouse07410 add the above comment to remind readers. And I merged the code segment into here without removing it.
/* | ||
* Make sure we have this amount of storage. | ||
*/ | ||
if(storage_size <= size) { | ||
free(storage); | ||
if(storage) free(storage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a parallel trend in this code base to remove if(foo) free(foo)
, since free is NULL-safe. Is there a particular reason to reintroduce if(storage)
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, you are right, because foo
is of type static char *
so it is initialized as 0.
It is not necessary to check against null.
Please feel free to remove it.
* Add MODULE name to resolve clash | ||
*/ | ||
if(expr->_mark & TM_NAMECLASH) { | ||
size += strlen(expr->module->ModuleName) + 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why +2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there are type names clash in different modules detected in asn1f_check_duplicate()
of asn1fix.c
, I add module name as prefix to the type name when making identifier for them :
M1 DEFINITIONS ::= BEGIN
V ::= INTEGER
END
M2 DEFINITIONS ::= BEGIN
V ::= OCTET STRING
END
The constructed type name becomes M1_V
and M2_V
instead V
and V
.
So space for one underscore character '_' and one null terminate character \0
equals 2.
By the way, I think TM_NAMECLASH
is not a good name (due to my poor English and limited vocabulary) and I am not sure whether expr->_mark
is a good place to hold the information what this expr
's name has duplication.
Please feel free to improve them at your solely discretion. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thank you.
Hi, I am reinstalling my laptop, might take some time before I can reply. Please stay tuned. |
By the way, this pull request only concentrates on Hope someone with deeper knowledge for ASN.1 and asn1c code can continue working on it. |
@brchiu, Thank you for improving the parsing. Indeed compilation phase is separate and I'll be able to help with that. Your patch is important and relevant on its own. |
Merged, thank you very much! |
These are unmerged lines of code that I forgot adding in pull request vlm#154.
…aints PER: fix encoding and decoding of OPENTYPE with size constraints
This is a collection of works :
Based on @zhanglei002 pull request 99.
A fix by @AuthenticEshkinKot and @ikarso, merged by @mouse07410 at
commit 2c8d36... of https://github.com/mouse07410/asn1c
to support parsing of Information Object and Information Object Set
A fix by @uri Blumenthal in asn1fix_derefv.c at :
commit ec0ade... of https://github.com/mouse07410/asn1c
to solve crash on asn1p_value_free().
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.
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.
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.
A fix of my bug in item 6 which result asn1c crash, fixed by @mouse07410.
My fix for another crash caused by item 6.
Add several test results for
check-parsing.sh
.Apply @velichkov 's commit to @mouse07410's https://github.com/mouse07410/asn1c for 'Do not generate coverage data for the test C code' and also remove
CODE_COVERAGE_CFLAGS
inskeletons/Makefile.am
Temporarily remove
make check
intravis.yml
to avoid Travis CI failure due to log larger than 4M bytes.