Skip to content

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

Closed
@dvyukov

Description

@dvyukov

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions