protobuf-go/proto
Damien Neil b0c26f1868 internal/impl: add message validator
This adds a experimental function to the internal/impl package which
validates a wire-format message against a message type. The validator
reports whether the message can be successfully unmarshaled, and whether
the result is initialized (all required fields are set). In some cases,
the validator returns ambiguous results when full validation would be
expensive.

The validator is unused outside of tests. In the future, it may be used
to permit lazy unmarshaling of some data. It is being added now for
testing; in particular, the wire fuzzer now checks the validator output
for consistency with the unmarshaler.

The validator adds a small amount of unused per-MessageType state. If
this becomes a concern, we could conditionalize it with a build tag.

Change-Id: I4216ef81d6a9ed975302eed189b02d08608858b4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/212302
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2020-01-07 21:36:47 +00:00
..
bench_test.go proto: rearrange test messages 2019-12-16 21:49:56 +00:00
decode_gen.go proto: consistently use non-nil, zero-length []bytes for empty bytes strings 2019-12-09 17:33:50 +00:00
decode_test.go proto: distinguish between invalid and empty messages in Equal 2020-01-06 19:37:38 +00:00
decode.go proto, internal/impl: reject invalid field numbers in map items 2019-12-21 00:16:12 +00:00
doc.go
encode_gen.go
encode_test.go internal/impl: add message validator 2020-01-07 21:36:47 +00:00
encode.go proto, internal/impl: don't create fast path Size for legacy Marshalers 2020-01-06 22:47:37 +00:00
equal_test.go proto: fix equality on nil values of different types 2020-01-06 23:36:47 +00:00
equal.go proto: fix equality on nil values of different types 2020-01-06 23:36:47 +00:00
extension_test.go internal/protolegacy: add stub v1 proto package for testing purposes 2019-10-05 23:12:32 +00:00
extension.go
isinit_test.go
isinit.go
merge_test.go proto: add MergeOptions.Shallow option 2020-01-06 20:26:20 +00:00
merge.go proto: add Clone function and MergeOptions.Clone method 2020-01-06 21:07:28 +00:00
messageset_test.go proto: rearrange test messages 2019-12-16 21:49:56 +00:00
messageset.go proto, internal/impl: store unknown MessageSet items in non-mset format 2019-11-11 19:40:27 +00:00
methods_test.go internal/impl: more checks for aberrant messages 2019-12-10 23:02:58 +00:00
noenforceutf8_test.go proto: rearrange test messages 2019-12-16 21:49:56 +00:00
proto_methods.go
proto_reflect.go
proto.go
reset_test.go
reset.go
size_gen.go
size.go proto, internal/impl: don't create fast path Size for legacy Marshalers 2020-01-06 22:47:37 +00:00
testmessages_test.go internal/impl: add message validator 2020-01-07 21:36:47 +00:00
validate_test.go internal/impl: add message validator 2020-01-07 21:36:47 +00:00
weak_test.go internal/impl: add message validator 2020-01-07 21:36:47 +00:00
wrappers.go