Invalid map is successfully decoded (original) (raw)

The following program crashes with the panic:

package main

import ( pb "github.com/dvyukov/go-fuzz/examples/protobuf/pb" "github.com/golang/protobuf/proto" )

func main() { data := []byte("\n\x02\n\x00") v := new(pb.M24) err := proto.Unmarshal(data, v) if err != nil { return } _, err = proto.Marshal(v) if err != nil { panic(err) } }

panic: proto: map has nil element

The proto used is:

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

The message should either be successfully encoded or not decoded.

on commit 34a5f24