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

encoding/asn1: UTF8String being unmarshalled as PrintableString and failing #8541

Closed
tommie opened this issue Aug 16, 2014 · 4 comments
Closed
Milestone

Comments

@tommie
Copy link

tommie commented Aug 16, 2014

> What does 'go version' print?

go version go1.3 linux/amd64

> What steps reproduce the problem?

Attempt to unmarshal a string with non-PrintableString characters in a field with a
context-specific tag and no EXPLICIT: http://play.golang.org/p/5bGjMTiq93

> What happened?

The Broken case returns an error.

> What should have happened instead?

Both cases should work. Most unexpected, note that the "utf8" parameter has no
effect when "tag:1" is present. Adding "explicit" makes Broken work.

Looking at the marshalling output, the Works does properly produce a UTF8String.

I think the problem is that the switch in
https://code.google.com/p/go/source/browse/src/pkg/encoding/asn1/asn1.go?name=go1.3.1#798
is seeing tagPrintableString because
https://code.google.com/p/go/source/browse/src/pkg/encoding/asn1/asn1.go?name=go1.3.1#643
doesn't match in the case of non-universal tags. I see no reference to param.stringType
in the unmarshaller, which is an indication this code does not handle the (non-explicit)
context-specific tags case.

I propose the following patch, falling back to using param.stringType if the on-wire tag
doesn't provide a clue.

Attachments:

  1. asn1printablestring.diff (1451 bytes)
@adg
Copy link
Contributor

adg commented Aug 18, 2014

Comment 1:

Labels changed: added release-go1.4, repo-main.

@robpike
Copy link
Contributor

robpike commented Aug 21, 2014

Comment 2:

We cannot accept patches through the issue tracker. Please suggest your change using the
process described at http://golang.org/doc/contribute.html

@rsc
Copy link
Contributor

rsc commented Sep 15, 2014

Comment 3:

agl, can you triage this? thanks.

Status changed to Thinking.

@agl
Copy link
Contributor

agl commented Sep 30, 2014

Comment 4:

This issue was closed by revision 1b89cd1.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants