mirror of
https://github.com/golang/go
synced 2024-11-24 21:00:09 -07:00
gob: reduce the maximum message size
It was 2^31, but that could cause overflow and trouble. Reduce it to 2^30 and add a TODO. R=golang-dev, iant CC=golang-dev https://golang.org/cl/5562049
This commit is contained in:
parent
387e7c2742
commit
6e1c0df104
@ -75,7 +75,9 @@ func (dec *Decoder) recvMessage() bool {
|
||||
dec.err = err
|
||||
return false
|
||||
}
|
||||
if nbytes >= 1<<31 {
|
||||
// Upper limit of 1GB, allowing room to grow a little without overflow.
|
||||
// TODO: We might want more control over this limit.
|
||||
if nbytes >= 1<<30 {
|
||||
dec.err = errBadCount
|
||||
return false
|
||||
}
|
||||
|
@ -547,7 +547,6 @@ func (a isZeroBugArray) GobEncode() (b []byte, e error) {
|
||||
}
|
||||
|
||||
func (a *isZeroBugArray) GobDecode(data []byte) error {
|
||||
println("DECODE")
|
||||
if len(data) != len(a) {
|
||||
return io.EOF
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user