mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-26 09:35:33 +00:00
fe15dd4cdd
The deprecated messageset format permits extension fields with numbers greater than the usual maximum (1<<29-1). To support this, the internal/encoding/wire package has disabled field number validation when legacy support is enabled. We shouldn't skip validating all field numbers for validity just because we support larger ones in messagesets. This change drops range validation from the wire package (other than checking that numbers fit in an int32) and adds it to the wire unmarshalers instead. This gives us validation where we care about it (when unmarshaling a wire-format message) and allows for best-effort handling of out-of-range numbers everywhere else. Fixes golang/protobuf#996 Change-Id: I4e11b8a8aa177dd60e89723570af074a317c2451 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/210290 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>