Skip to content

encoding/asn1: possible inconsistency between asn1 tag and unmarshal parameter #44288

@ale-linux

Description

@ale-linux

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?

Yes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions