]> Cypherpunks repositories - gostls13.git/commit
encoding/binary: on invalid type return -1 from Size
authorIan Lance Taylor <iant@golang.org>
Tue, 20 Jun 2023 16:38:39 +0000 (09:38 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 20 Jun 2023 18:28:44 +0000 (18:28 +0000)
commite122ebabb657021964f2bdd31e683ddfa023fd0c
tree20e44ebcd894cfd634890581ce3481328b3ddc2d
parent8484f2fe0250f16304f3112b1caee5a32e685823
encoding/binary: on invalid type return -1 from Size

Size is defined as returning -1 if the type is not fixed-size.
Before this CL cases like Size((*[]int)(nil)) would crash.

Fixes #60892

Change-Id: Iee8e20a0aee24b542b78cb4160c3b2c5a3eb02c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/504575
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/encoding/binary/binary.go
src/encoding/binary/binary_test.go