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: index out of range #11129

Closed
dvyukov opened this issue Jun 9, 2015 · 1 comment
Closed

encoding/asn1: index out of range #11129

dvyukov opened this issue Jun 9, 2015 · 1 comment
Assignees
Milestone

Comments

@dvyukov
Copy link
Member

@dvyukov dvyukov commented Jun 9, 2015

The following program crashes with the panic:

package main

import "encoding/asn1"

func main() {
    asn1.Unmarshal([]byte("0\b\x02\x010@\x010\xa00"), new(X))
}

type X struct {
    A  int
    A1 int `asn1:"application"`
    A2 int `asn1:"optional"`
    A3 int `asn1:"optional,default:123"`
    A4 int `asn1:"explicit"`
    A5 int `asn1:"tag:0"`
}
panic: runtime error: index out of range

goroutine 1 [running]:
encoding/asn1.parseTagAndLength(0xc20800a472, 0x8, 0xe, 0x8, 0x2, 0x0, 0x0, 0x1, 0x8, 0x0, ...)
    src/encoding/asn1/asn1.go:393 +0x43d
encoding/asn1.parseField(0x4e95a0, 0xc208016410, 0xc2, 0xc20800a472, 0x8, 0xe, 0x6, 0x100, 0x0, 0xc20800a550, ...)
    src/encoding/asn1/asn1.go:617 +0x1329
encoding/asn1.parseField(0x5223e0, 0xc2080163f0, 0xd9, 0xc20800a470, 0xa, 0x10, 0x0, 0x0, 0x0, 0x0, ...)
    src/encoding/asn1/asn1.go:781 +0x3238
encoding/asn1.UnmarshalWithParams(0xc20800a470, 0xa, 0x10, 0x4dd000, 0xc2080163f0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    src/encoding/asn1/asn1.go:920 +0x16e
encoding/asn1.Unmarshal(0xc20800a470, 0xa, 0x10, 0x4dd000, 0xc2080163f0, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/encoding/asn1/asn1.go:913 +0x8f
main.main()
    asn1.go:6 +0x96

on commit b0532a9

@dvyukov dvyukov added this to the Go1.5 milestone Jun 9, 2015
@agl
Copy link
Contributor

@agl agl commented Jun 13, 2015

Kyle Isom also found this (and also with go-fuzz I suspect). I created #11154 for that.

@agl agl closed this Jun 13, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.