golang/go

encoding/asn1: call of reflect.Value.Type on zero Value

dvyukov opened this issue · 1 comments

The following program crashes with the panic:

package main

import "encoding/asn1"

func main() {
    var v interface{}
    asn1.Marshal(v)
}
panic: reflect: call of reflect.Value.Type on zero Value

goroutine 1 [running]:
reflect.Value.Type(0x0, 0x0, 0x0, 0x0, 0x0)
    src/reflect/value.go:1664 +0x7b
encoding/asn1.marshalField(0xc20807deb0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    src/encoding/asn1/marshal.go:536 +0x540
encoding/asn1.Marshal(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    src/encoding/asn1/marshal.go:646 +0x14d
main.main()
    asn1.go:7 +0x2d

Marshal should return an error instead.

on commit b0532a9

CL https://golang.org/cl/13923 mentions this issue.