internal/impl: messageset validation and isinit fixes
Recognize messagesets in the validator. Currently, this just gives
up and reports an unknown validity rather than trying to descend
into the messageset.
Plumb fast-path initialization checks through messageset decoding.
Change-Id: Ice55f28e8555764e4ce2720251830e8cf475c133
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/216245
Reviewed-by: Joe Tsai <joetsai@google.com>
diff --git a/internal/impl/validate.go b/internal/impl/validate.go
index 1d34063..cb6a820 100644
--- a/internal/impl/validate.go
+++ b/internal/impl/validate.go
@@ -12,6 +12,7 @@
"unicode/utf8"
"google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/internal/strs"
pref "google.golang.org/protobuf/reflect/protoreflect"
preg "google.golang.org/protobuf/reflect/protoregistry"
@@ -242,6 +243,9 @@
st := &states[len(states)-1]
if st.mi != nil {
st.mi.init()
+ if flags.ProtoLegacy && st.mi.isMessageSet {
+ return ValidationUnknown
+ }
}
Field:
for len(b) > 0 {