aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/floatmarsh_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/big/floatmarsh_test.go')
-rw-r--r--src/math/big/floatmarsh_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math/big/floatmarsh_test.go b/src/math/big/floatmarsh_test.go
index c056d78b800..401f45a51fe 100644
--- a/src/math/big/floatmarsh_test.go
+++ b/src/math/big/floatmarsh_test.go
@@ -137,3 +137,15 @@ func TestFloatJSONEncoding(t *testing.T) {
}
}
}
+
+func TestFloatGobDecodeShortBuffer(t *testing.T) {
+ for _, tc := range [][]byte{
+ []byte{0x1, 0x0, 0x0, 0x0},
+ []byte{0x1, 0xfa, 0x0, 0x0, 0x0, 0x0},
+ } {
+ err := NewFloat(0).GobDecode(tc)
+ if err == nil {
+ t.Error("expected GobDecode to return error for malformed input")
+ }
+ }
+}