Skip to content
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

Conversation

brchiu
Copy link
Contributor

@brchiu brchiu commented May 7, 2017

This is a collection of works :

  1. Based on @zhanglei002 pull request 99.

  2. 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

  3. 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().

  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.

  8. My fix for another crash caused by item 6.

  9. Add several test results for check-parsing.sh.

  10. 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 in skeletons/Makefile.am

  11. Temporarily remove make check in travis.yml to avoid Travis CI failure due to log larger than 4M bytes.

@coveralls
Copy link

coveralls commented May 7, 2017

Coverage Status

Coverage decreased (-0.2%) to 77.745% when pulling 95317cd on brchiu:vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc into 4021e4b on vlm:master.

…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.
@brchiu brchiu force-pushed the vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc branch from 95317cd to 80fd306 Compare May 7, 2017 14:21
@coveralls
Copy link

coveralls commented May 7, 2017

Coverage Status

Coverage decreased (-0.2%) to 77.746% when pulling 80fd306 on brchiu:vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc into 4021e4b on vlm:master.

@coveralls
Copy link

coveralls commented May 8, 2017

Coverage Status

Coverage decreased (-0.1%) to 77.769% when pulling 2d6b8c0 on brchiu:vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc into 4021e4b on vlm:master.

@brchiu brchiu force-pushed the vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc branch from 2383076 to 2d6b8c0 Compare May 8, 2017 07:30
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.
@coveralls
Copy link

coveralls commented May 8, 2017

Coverage Status

Coverage decreased (-6.2%) to 71.66% when pulling c46137b on brchiu:vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc into 4021e4b on vlm:master.

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.
@vlm
Copy link
Owner

vlm commented May 8, 2017

Thank you! Looking into it.

@@ -9,7 +9,6 @@ script:
- autoreconf -iv
- ./configure --enable-Werror --enable-code-coverage
- make -j8
- make check
Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

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?

Copy link
Contributor Author

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! */
Copy link
Owner

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?

Copy link
Contributor Author

@brchiu brchiu May 8, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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);
Copy link
Owner

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?

Copy link
Contributor Author

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why +2?

Copy link
Contributor Author

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you.

@brchiu
Copy link
Contributor Author

brchiu commented May 8, 2017

Hi, I am reinstalling my laptop, might take some time before I can reply. Please stay tuned.

@brchiu
Copy link
Contributor Author

brchiu commented May 8, 2017

By the way, this pull request only concentrates on parse and fix phases when dealing information object/information object set. But it does not address on the compilation phase. There seems no data structures or files generated for information object and/or information object set.

Hope someone with deeper knowledge for ASN.1 and asn1c code can continue working on it.

@vlm
Copy link
Owner

vlm commented May 8, 2017

@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.

@vlm vlm merged commit 993eca8 into vlm:master Jun 27, 2017
@vlm
Copy link
Owner

vlm commented Jun 27, 2017

Merged, thank you very much!

brchiu referenced this pull request Jun 27, 2017
brchiu added a commit to brchiu/asn1c that referenced this pull request Jun 28, 2017
These are unmerged lines of code that I forgot adding in pull request vlm#154.
@brchiu brchiu deleted the vlm_master_merge_pr99_mouse_2c8d366b_solve_prob_for_s1ap_nbap_dsrc branch October 22, 2017 13:25
attina pushed a commit to attina/asn1c that referenced this pull request Dec 26, 2023
…aints

PER: fix encoding and decoding of OPENTYPE with size constraints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants