• Emmanuel Odeke's avatar
    encoding/gob: error out instead of panicking on nil dereference · 0a2a64d8
    Emmanuel Odeke authored
    Do not panic when we encounter nil interface values which are
    invalid values for gob. Previously this wasn't caught yet
    we were calling reflect.*.Type() on reflect.Invalid values
    thereby causing panic:
      `panic: reflect: call of reflect.Value.Type on zero Value.`
    which is a panic not enforced by encoding/gob itself.
    We can catch this and send back an error to the caller.
    
    Fixes #16204
    
    Change-Id: Ie646796db297759a74a02eee5267713adbe0c3a0
    Reviewed-on: https://go-review.googlesource.com/24989Reviewed-by: 's avatarRob Pike <r@golang.org>
    Run-TryBot: Rob Pike <r@golang.org>
    0a2a64d8
Name
Last commit
Last update
..
codec_test.go Loading commit data...
debug.go Loading commit data...
dec_helpers.go Loading commit data...
decgen.go Loading commit data...
decode.go Loading commit data...
decoder.go Loading commit data...
doc.go Loading commit data...
dump.go Loading commit data...
enc_helpers.go Loading commit data...
encgen.go Loading commit data...
encode.go Loading commit data...
encoder.go Loading commit data...
encoder_test.go Loading commit data...
error.go Loading commit data...
example_encdec_test.go Loading commit data...
example_interface_test.go Loading commit data...
example_test.go Loading commit data...
gobencdec_test.go Loading commit data...
timing_test.go Loading commit data...
type.go Loading commit data...
type_test.go Loading commit data...