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

Failure parsing minimal example with VisibleString #56

Open
rbdixon opened this issue Aug 29, 2017 · 3 comments
Open

Failure parsing minimal example with VisibleString #56

rbdixon opened this issue Aug 29, 2017 · 3 comments

Comments

@rbdixon
Copy link

rbdixon commented Aug 29, 2017

This is valid according to ASN.1 Playground:

Test DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

UARFCN ::= INTEGER(0..16383)
FQDN ::= VisibleString(FROM ("a".."z" | "A".."Z" | "0".."9" | ".-")) (SIZE (1..255))

END

This is excerpted from Wireshark's ULP support.

The example above fails with:

Traceback (most recent call last):
  File "../.direnv/python-2.7.13/lib/python2.7/site-packages/asn1ate/pyasn1gen.py", line 588, in <module>
    sys.exit(main(sys.argv[1:]))
  File "../.direnv/python-2.7.13/lib/python2.7/site-packages/asn1ate/pyasn1gen.py", line 574, in main
    parse_tree = parser.parse_asn1(asn1def)
  File "/Users/rbdixon/projects/library/201708-vzw-lte_precloc/testing/fuzz/.direnv/python-2.7.13/lib/python2.7/site-packages/asn1ate/parser.py", line 40, in parse_asn1
    parse_result = grammar.parseString(asn1_definition)
  File "/Users/rbdixon/projects/library/201708-vzw-lte_precloc/testing/fuzz/.direnv/python-2.7.13/lib/python2.7/site-packages/pyparsing.py", line 1632, in parseString
    raise exc
pyparsing.ParseException: Expected "END" (at char 94), (line:5, col:23)

I believe that VisibleString is supported since it is parsed correctly elsewhere in my ASN.1 example. Any advice on getting this going?

@kimgr
Copy link
Owner

kimgr commented Aug 29, 2017

Thanks for the report. I think the constraint is the problem in this case, there's definitely no support for FROM (which I think is a so-called alphabet constraint), but the SIZE might be accepted for VisibleString.

I don't think constraints make it through the encoding, so you could try removing the constraints and hope for the best.

@rbdixon
Copy link
Author

rbdixon commented Aug 29, 2017

This was my thought, too. I did some goofing around and this fails as well:

Test DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

FQDN ::= VisibleString() (SIZE (1..255))

END

I'll noodle around on this a bit. Just thought I'd bring it up in case there was an obvious issue.

@rbdixon
Copy link
Author

rbdixon commented Aug 29, 2017

Actually... when I turn the brain on:

Test DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

FQDN ::= VisibleString(SIZE (1..255))

END

This works. Let me give this a whirl.

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

No branches or pull requests

2 participants