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

call of reflect.Value.Interface on zero Value in MarshalText #33

Closed
dvyukov opened this issue May 25, 2015 · 0 comments
Closed

call of reflect.Value.Interface on zero Value in MarshalText #33

dvyukov opened this issue May 25, 2015 · 0 comments
Assignees

Comments

@dvyukov
Copy link
Member

dvyukov commented May 25, 2015

The following program crashes with a panic:

package main

import (
    "github.com/golang/protobuf/proto"
    "io/ioutil"
    pb "protorepro/pb"
)

func main() {
    proto.MarshalText(ioutil.Discard, &pb.M2{F: map[string]*pb.M1{"": nil}})
}
panic: reflect: call of reflect.Value.Interface on zero Value

goroutine 1 [running]:
runtime.gopanic(0x52e860, 0xc20800e4a0)
    src/runtime/panic.go:461 +0x401 fp=0xc2080415a0 sp=0xc208041520
reflect.valueInterface(0x0, 0x0, 0x0, 0x542801, 0x0, 0x0)
    src/reflect/value.go:906 +0x82 fp=0xc2080415f8 sp=0xc2080415a0
reflect.Value.Interface(0x0, 0x0, 0x0, 0x0, 0x0)
    src/reflect/value.go:901 +0x4f fp=0xc208041630 sp=0xc2080415f8
github.com/golang/protobuf/proto.writeAny(0xc20800e400, 0x0, 0x0, 0x0, 0xc208070240, 0x0, 0x0)
    src/github.com/golang/protobuf/proto/text.go:465 +0x632 fp=0xc2080417f8 sp=0xc208041630
github.com/golang/protobuf/proto.writeStruct(0xc20800e400, 0x536380, 0xc20800e3e0, 0xd9, 0x0, 0x0)
    src/github.com/golang/protobuf/proto/text.go:295 +0xf89 fp=0xc208041da0 sp=0xc2080417f8
github.com/golang/protobuf/proto.marshalText(0x7f558bbca1e8, 0xc20800a5f0, 0x7f558bbca210, 0xc20800e3e0, 0x62c100, 0x0, 0x0)
    src/github.com/golang/protobuf/proto/text.go:759 +0x440 fp=0xc208041ee0 sp=0xc208041da0
github.com/golang/protobuf/proto.MarshalText(0x7f558bbca1e8, 0xc20800a5f0, 0x7f558bbca210, 0xc20800e3e0, 0x0, 0x0)
    src/github.com/golang/protobuf/proto/text.go:771 +0x57 fp=0xc208041f20 sp=0xc208041ee0
main.main()
    protorepro.go:10 +0x129 fp=0xc208041f90 sp=0xc208041f20

The proto used is:

syntax = "proto2";

package example;

message M1 {
  optional uint32 f = 1;
}

message M2 {
  map<string, M1> f = 1;
}

golang/protobuf is on 16256d3
protobuf is on fe7b566

@dsymonds dsymonds self-assigned this May 25, 2015
linkedincn pushed a commit to linkedin-inc/protobuf that referenced this issue Jul 9, 2015
@golang golang locked as resolved and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants