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: possible inconsistency between asn1 tag and unmarshal parameter #44288

ale-linux opened this issue Feb 16, 2021 · 0 comments


Copy link

@ale-linux ale-linux commented Feb 16, 2021

What version of Go are you using (go version)?

$ go version
go version go1.15.8 linux/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

Ubuntu 18.04.5 LTS/x86_64

What did you do?

I stumbled upon this (possible) inconsistency between the asn1 tag embedded in a byte slice to be unmarshalled as asn1 and the parameter supplied to the unmarshaller. It seems that it's possible, for instance, to unmarshal the following byte array (specifying the "printable" parameter)

[]byte{20 /* TagT61String */, 13, 72, 101, 108, 108, 111, 44, 32, /* 2 non-ASCII chars follow*/ 228, 184, 150, 231, 149, 140}

while in fact it

  1. is tagged as a T.61 string
  2. contains non-ASCII characters.

More examples available here

What did you expect to see?

An error

What did you see instead?

No error and a successful unmarshalling

@seankhliao seankhliao changed the title Possible inconsistency between asn1 tag and unmarshal parameter encoding/asn1: possible inconsistency between asn1 tag and unmarshal parameter Feb 16, 2021
@seankhliao seankhliao added the NeedsInvestigation label Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants