1
0
mirror of https://github.com/golang/go synced 2024-09-30 19:28:32 -06:00
go/src/encoding/gob
Emmanuel Odeke 0a2a64d85d encoding/gob: error out instead of panicking on nil dereference
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/24989
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
2016-08-19 21:54:39 +00:00
..
codec_test.go all: fix copy-and-paste errors in tests 2016-05-06 16:56:19 +00:00
debug.go all: single space after period. 2016-03-02 00:13:47 +00:00
dec_helpers.go encoding/gob: reduce the amount of memory allocations. 2015-11-25 17:01:25 +00:00
decgen.go encoding/gob: reduce the amount of memory allocations. 2015-11-25 17:01:25 +00:00
decode.go encoding/gob: avoid allocating string for map key 2016-06-28 01:50:48 +00:00
decoder.go all: single space after period. 2016-03-02 00:13:47 +00:00
doc.go encoding/gob: document Encode, EncodeValue nil pointer panics 2016-07-05 06:36:21 +00:00
dump.go
enc_helpers.go encoding/gob: custom array/slice decoders 2014-10-17 12:37:41 -07:00
encgen.go encoding/gob: custom array/slice decoders 2014-10-17 12:37:41 -07:00
encode.go all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
encoder_test.go encoding/gob: error out instead of panicking on nil dereference 2016-08-19 21:54:39 +00:00
encoder.go encoding/gob: error out instead of panicking on nil dereference 2016-08-19 21:54:39 +00:00
error.go all: single space after period. 2016-03-02 00:13:47 +00:00
example_encdec_test.go
example_interface_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
example_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
gobencdec_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
timing_test.go encoding/gob: reduce the amount of memory allocations. 2015-11-25 17:01:25 +00:00
type_test.go
type.go all: single space after period. 2016-03-02 00:13:47 +00:00