diff --git a/plugin/unmarshal/unmarshal.go b/plugin/unmarshal/unmarshal.go index e29565d864..9a2374b563 100644 --- a/plugin/unmarshal/unmarshal.go +++ b/plugin/unmarshal/unmarshal.go @@ -1578,6 +1578,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) { p.P(`func skip` + p.localName + `(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1609,10 +1610,8 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1633,57 +1632,32 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) { return 0, ErrInvalidLength` + p.localName + ` } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLength` + p.localName + ` - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow` + p.localName + ` - } - if iNdEx >= l { - return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skip` + p.localName + `(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLength` + p.localName + ` - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup` + p.localName + ` + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, ` + fmtPkg.Use() + `.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLength` + p.localName + ` + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF } var ( ErrInvalidLength` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: negative length found during unmarshaling") ErrIntOverflow` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: unexpected end of group") ) `) } diff --git a/test/asymetric-issue125/asym.pb.go b/test/asymetric-issue125/asym.pb.go index 22fef6aee1..a960a97c39 100644 --- a/test/asymetric-issue125/asym.pb.go +++ b/test/asymetric-issue125/asym.pb.go @@ -549,6 +549,7 @@ func (m *MyType) Unmarshal(dAtA []byte) error { func skipAsym(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -580,10 +581,8 @@ func skipAsym(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -604,55 +603,30 @@ func skipAsym(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthAsym } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthAsym - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAsym - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipAsym(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthAsym - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAsym + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthAsym + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthAsym = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAsym = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthAsym = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAsym = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAsym = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/casttype/combos/both/casttype.pb.go b/test/casttype/combos/both/casttype.pb.go index a998e58240..0191067fce 100644 --- a/test/casttype/combos/both/casttype.pb.go +++ b/test/casttype/combos/both/casttype.pb.go @@ -2553,6 +2553,7 @@ func (m *Wilson) Unmarshal(dAtA []byte) error { func skipCasttype(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2584,10 +2585,8 @@ func skipCasttype(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2608,55 +2607,30 @@ func skipCasttype(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthCasttype } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthCasttype - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCasttype - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCasttype(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthCasttype - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCasttype + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthCasttype + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthCasttype = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCasttype = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthCasttype = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCasttype = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCasttype = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/casttype/combos/unmarshaler/casttype.pb.go b/test/casttype/combos/unmarshaler/casttype.pb.go index b5724c4979..4f61c03599 100644 --- a/test/casttype/combos/unmarshaler/casttype.pb.go +++ b/test/casttype/combos/unmarshaler/casttype.pb.go @@ -2319,6 +2319,7 @@ func (m *Wilson) Unmarshal(dAtA []byte) error { func skipCasttype(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2350,10 +2351,8 @@ func skipCasttype(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2374,55 +2373,30 @@ func skipCasttype(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthCasttype } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthCasttype - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCasttype - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCasttype(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthCasttype - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCasttype + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthCasttype + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthCasttype = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCasttype = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthCasttype = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCasttype = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCasttype = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/castvalue/combos/both/castvalue.pb.go b/test/castvalue/combos/both/castvalue.pb.go index e1761bc2fd..aa00bc6598 100644 --- a/test/castvalue/combos/both/castvalue.pb.go +++ b/test/castvalue/combos/both/castvalue.pb.go @@ -1396,6 +1396,7 @@ func (m *Wilson) Unmarshal(dAtA []byte) error { func skipCastvalue(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1427,10 +1428,8 @@ func skipCastvalue(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1451,55 +1450,30 @@ func skipCastvalue(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthCastvalue } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthCastvalue - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCastvalue - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCastvalue(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthCastvalue - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCastvalue + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthCastvalue + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthCastvalue = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCastvalue = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthCastvalue = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCastvalue = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCastvalue = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/castvalue/combos/unmarshaler/castvalue.pb.go b/test/castvalue/combos/unmarshaler/castvalue.pb.go index c780e1b181..3cf29d6066 100644 --- a/test/castvalue/combos/unmarshaler/castvalue.pb.go +++ b/test/castvalue/combos/unmarshaler/castvalue.pb.go @@ -1262,6 +1262,7 @@ func (m *Wilson) Unmarshal(dAtA []byte) error { func skipCastvalue(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1293,10 +1294,8 @@ func skipCastvalue(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1317,55 +1316,30 @@ func skipCastvalue(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthCastvalue } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthCastvalue - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCastvalue - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCastvalue(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthCastvalue - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCastvalue + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthCastvalue + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthCastvalue = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCastvalue = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthCastvalue = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCastvalue = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCastvalue = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/combos/both/thetest.pb.go b/test/combos/both/thetest.pb.go index 08b25b5387..0c02cab405 100644 --- a/test/combos/both/thetest.pb.go +++ b/test/combos/both/thetest.pb.go @@ -47322,6 +47322,7 @@ func (m *ProtoType) Unmarshal(dAtA []byte) error { func skipThetest(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -47353,10 +47354,8 @@ func skipThetest(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -47377,55 +47376,30 @@ func skipThetest(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthThetest } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthThetest - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowThetest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipThetest(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthThetest - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupThetest + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthThetest + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthThetest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowThetest = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthThetest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowThetest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupThetest = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/combos/unmarshaler/thetest.pb.go b/test/combos/unmarshaler/thetest.pb.go index cc6ebc9058..b4f63ae7a2 100644 --- a/test/combos/unmarshaler/thetest.pb.go +++ b/test/combos/unmarshaler/thetest.pb.go @@ -42202,6 +42202,7 @@ func (m *ProtoType) Unmarshal(dAtA []byte) error { func skipThetest(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -42233,10 +42234,8 @@ func skipThetest(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -42257,55 +42256,30 @@ func skipThetest(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthThetest } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthThetest - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowThetest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipThetest(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthThetest - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupThetest + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthThetest + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthThetest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowThetest = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthThetest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowThetest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupThetest = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/custombytesnonstruct/proto.pb.go b/test/custombytesnonstruct/proto.pb.go index a643593b86..1986833b6c 100644 --- a/test/custombytesnonstruct/proto.pb.go +++ b/test/custombytesnonstruct/proto.pb.go @@ -201,6 +201,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { func skipProto(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -232,10 +233,8 @@ func skipProto(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -256,55 +255,30 @@ func skipProto(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProto } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProto - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProto - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProto + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProto + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProto = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/data/data.pb.go b/test/data/data.pb.go index 8935639179..ccc7cd05b3 100644 --- a/test/data/data.pb.go +++ b/test/data/data.pb.go @@ -413,6 +413,7 @@ func (m *MyMessage) Unmarshal(dAtA []byte) error { func skipData(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -444,10 +445,8 @@ func skipData(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -468,55 +467,30 @@ func skipData(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthData } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthData - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowData - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipData(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthData - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupData + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthData + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthData = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowData = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthData = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowData = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupData = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/empty-issue70/empty.pb.go b/test/empty-issue70/empty.pb.go index d6cc771ecd..9e97bf209e 100644 --- a/test/empty-issue70/empty.pb.go +++ b/test/empty-issue70/empty.pb.go @@ -125,6 +125,7 @@ func (m *TestRequest) Unmarshal(dAtA []byte) error { func skipEmpty(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -156,10 +157,8 @@ func skipEmpty(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -180,55 +179,30 @@ func skipEmpty(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthEmpty } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthEmpty - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEmpty - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEmpty(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthEmpty - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEmpty + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthEmpty + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEmpty = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/enumdecl/enumdecl.pb.go b/test/enumdecl/enumdecl.pb.go index f762751eb2..cbc4897292 100644 --- a/test/enumdecl/enumdecl.pb.go +++ b/test/enumdecl/enumdecl.pb.go @@ -394,6 +394,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { func skipEnumdecl(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -425,10 +426,8 @@ func skipEnumdecl(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -449,55 +448,30 @@ func skipEnumdecl(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthEnumdecl } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthEnumdecl - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEnumdecl - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEnumdecl(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthEnumdecl - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEnumdecl + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthEnumdecl + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthEnumdecl = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEnumdecl = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthEnumdecl = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEnumdecl = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEnumdecl = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/enumdecl_all/enumdeclall.pb.go b/test/enumdecl_all/enumdeclall.pb.go index 2f0979a6a0..7c7deae763 100644 --- a/test/enumdecl_all/enumdeclall.pb.go +++ b/test/enumdecl_all/enumdeclall.pb.go @@ -466,6 +466,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { func skipEnumdeclall(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -497,10 +498,8 @@ func skipEnumdeclall(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -521,55 +520,30 @@ func skipEnumdeclall(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthEnumdeclall } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthEnumdeclall - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEnumdeclall - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEnumdeclall(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthEnumdeclall - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEnumdeclall + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthEnumdeclall + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthEnumdeclall = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEnumdeclall = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthEnumdeclall = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEnumdeclall = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEnumdeclall = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/example/example.pb.go b/test/example/example.pb.go index e23f67a638..7fffdfa82e 100644 --- a/test/example/example.pb.go +++ b/test/example/example.pb.go @@ -2690,6 +2690,7 @@ func (m *CastType) Unmarshal(dAtA []byte) error { func skipExample(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2721,10 +2722,8 @@ func skipExample(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2745,55 +2744,30 @@ func skipExample(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthExample } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthExample - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowExample - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipExample(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthExample - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupExample + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthExample + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthExample = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowExample = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthExample = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowExample = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupExample = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/fuzztests/fuzz.pb.go b/test/fuzztests/fuzz.pb.go index d9f66affc6..57a3820107 100644 --- a/test/fuzztests/fuzz.pb.go +++ b/test/fuzztests/fuzz.pb.go @@ -2973,6 +2973,7 @@ func (m *NinOptStruct) Unmarshal(dAtA []byte) error { func skipFuzz(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3004,10 +3005,8 @@ func skipFuzz(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3028,55 +3027,30 @@ func skipFuzz(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthFuzz } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthFuzz - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowFuzz - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipFuzz(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthFuzz - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFuzz + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthFuzz + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthFuzz = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowFuzz = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthFuzz = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFuzz = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFuzz = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/importcustom-issue389/imported/a.pb.go b/test/importcustom-issue389/imported/a.pb.go index f8bfb01a6e..4c56662b6f 100644 --- a/test/importcustom-issue389/imported/a.pb.go +++ b/test/importcustom-issue389/imported/a.pb.go @@ -353,6 +353,7 @@ func (m *A) Unmarshal(dAtA []byte) error { func skipA(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -384,10 +385,8 @@ func skipA(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -408,55 +407,30 @@ func skipA(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthA } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthA - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowA - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipA(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthA - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupA + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthA + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthA = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowA = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthA = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowA = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupA = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/importcustom-issue389/importing/c.pb.go b/test/importcustom-issue389/importing/c.pb.go index fe6b0d29d6..39eaec46c2 100644 --- a/test/importcustom-issue389/importing/c.pb.go +++ b/test/importcustom-issue389/importing/c.pb.go @@ -367,6 +367,7 @@ func (m *C) Unmarshal(dAtA []byte) error { func skipC(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -398,10 +399,8 @@ func skipC(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -422,55 +421,30 @@ func skipC(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthC } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthC - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowC - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipC(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthC - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupC + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthC + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthC = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowC = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthC = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowC = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupC = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/indeximport-issue72/index/index.pb.go b/test/indeximport-issue72/index/index.pb.go index e3d3f01ca9..01035cd47e 100644 --- a/test/indeximport-issue72/index/index.pb.go +++ b/test/indeximport-issue72/index/index.pb.go @@ -429,6 +429,7 @@ func (m *IndexQuery) Unmarshal(dAtA []byte) error { func skipIndex(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -460,10 +461,8 @@ func skipIndex(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -484,55 +483,30 @@ func skipIndex(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIndex } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIndex - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIndex - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIndex(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIndex - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIndex + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIndex + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIndex = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIndex = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIndex = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIndex = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIndex = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/indeximport-issue72/indeximport.pb.go b/test/indeximport-issue72/indeximport.pb.go index 9083cb8976..a945b5d752 100644 --- a/test/indeximport-issue72/indeximport.pb.go +++ b/test/indeximport-issue72/indeximport.pb.go @@ -379,6 +379,7 @@ func (m *IndexQueries) Unmarshal(dAtA []byte) error { func skipIndeximport(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -410,10 +411,8 @@ func skipIndeximport(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -434,55 +433,30 @@ func skipIndeximport(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIndeximport } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIndeximport - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIndeximport - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIndeximport(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIndeximport - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIndeximport + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIndeximport + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIndeximport = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIndeximport = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIndeximport = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIndeximport = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIndeximport = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/int64support/object.pb.go b/test/int64support/object.pb.go index 9c80f6f139..44b50cbbde 100644 --- a/test/int64support/object.pb.go +++ b/test/int64support/object.pb.go @@ -415,6 +415,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { func skipObject(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -446,10 +447,8 @@ func skipObject(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -470,55 +469,30 @@ func skipObject(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthObject } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthObject - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowObject - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipObject(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthObject - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupObject + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthObject + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthObject = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowObject = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthObject = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowObject = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupObject = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue260/issue260.pb.go b/test/issue260/issue260.pb.go index 891dadf753..64c0a318f4 100644 --- a/test/issue260/issue260.pb.go +++ b/test/issue260/issue260.pb.go @@ -1004,6 +1004,7 @@ func (m *Kept) Unmarshal(dAtA []byte) error { func skipIssue260(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1035,10 +1036,8 @@ func skipIssue260(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1059,55 +1058,30 @@ func skipIssue260(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue260 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue260 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue260 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue260(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue260 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue260 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue260 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue260 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue260 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue260 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue260 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue260 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue261/issue261.pb.go b/test/issue261/issue261.pb.go index 38becbc0d8..e2ba9bcf50 100644 --- a/test/issue261/issue261.pb.go +++ b/test/issue261/issue261.pb.go @@ -443,6 +443,7 @@ func (m *MapStdTypes) Unmarshal(dAtA []byte) error { func skipIssue261(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -474,10 +475,8 @@ func skipIssue261(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -498,55 +497,30 @@ func skipIssue261(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue261 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue261 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue261 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue261(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue261 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue261 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue261 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue261 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue261 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue261 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue261 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue261 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue262/timefail.pb.go b/test/issue262/timefail.pb.go index 4abf3ff160..b7377ee8cb 100644 --- a/test/issue262/timefail.pb.go +++ b/test/issue262/timefail.pb.go @@ -315,6 +315,7 @@ func (m *TimeFail) Unmarshal(dAtA []byte) error { func skipTimefail(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -346,10 +347,8 @@ func skipTimefail(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -370,55 +369,30 @@ func skipTimefail(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTimefail } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTimefail - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTimefail - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTimefail(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTimefail - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTimefail + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTimefail + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTimefail = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTimefail = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTimefail = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTimefail = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTimefail = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue322/issue322.pb.go b/test/issue322/issue322.pb.go index e5c0cdb729..e124f2df5b 100644 --- a/test/issue322/issue322.pb.go +++ b/test/issue322/issue322.pb.go @@ -568,6 +568,7 @@ func (m *OneofTest) Unmarshal(dAtA []byte) error { func skipIssue322(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -599,10 +600,8 @@ func skipIssue322(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -623,55 +622,30 @@ func skipIssue322(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue322 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue322 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue322 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue322(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue322 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue322 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue322 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue322 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue322 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue322 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue322 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue322 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue330/issue330.pb.go b/test/issue330/issue330.pb.go index 9114fafc3a..94648e3bfc 100644 --- a/test/issue330/issue330.pb.go +++ b/test/issue330/issue330.pb.go @@ -339,6 +339,7 @@ func (m *Object) Unmarshal(dAtA []byte) error { func skipIssue330(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -370,10 +371,8 @@ func skipIssue330(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -394,55 +393,30 @@ func skipIssue330(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue330 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue330 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue330 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue330(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue330 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue330 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue330 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue330 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue330 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue330 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue330 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue330 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue34/proto.pb.go b/test/issue34/proto.pb.go index 57571fa25a..6eedb6e67e 100644 --- a/test/issue34/proto.pb.go +++ b/test/issue34/proto.pb.go @@ -294,6 +294,7 @@ func (m *FooWithRepeated) Unmarshal(dAtA []byte) error { func skipProto(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -325,10 +326,8 @@ func skipProto(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -349,55 +348,30 @@ func skipProto(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProto } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProto - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProto - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProto + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProto + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProto = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue42order/issue42.pb.go b/test/issue42order/issue42.pb.go index eef6d5384b..4d7eb42a7f 100644 --- a/test/issue42order/issue42.pb.go +++ b/test/issue42order/issue42.pb.go @@ -567,6 +567,7 @@ func (m *OrderedFields) Unmarshal(dAtA []byte) error { func skipIssue42(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -598,10 +599,8 @@ func skipIssue42(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -622,55 +621,30 @@ func skipIssue42(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue42 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue42 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue42 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue42(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue42 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue42 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue42 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue42 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue42 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue42 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue42 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue42 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue449/issue449.pb.go b/test/issue449/issue449.pb.go index 60b8cd3bd0..f0167d91ea 100644 --- a/test/issue449/issue449.pb.go +++ b/test/issue449/issue449.pb.go @@ -504,6 +504,7 @@ func (m *CodeGenMsg) Unmarshal(dAtA []byte) error { func skipIssue449(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -535,10 +536,8 @@ func skipIssue449(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -559,55 +558,30 @@ func skipIssue449(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue449 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue449 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue449 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue449(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue449 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue449 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue449 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue449 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue449 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue449 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue449 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue449 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue498/issue498.pb.go b/test/issue498/issue498.pb.go index 2a1d170b84..6aefa13e08 100644 --- a/test/issue498/issue498.pb.go +++ b/test/issue498/issue498.pb.go @@ -516,6 +516,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { func skipIssue498(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -547,10 +548,8 @@ func skipIssue498(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -571,55 +570,30 @@ func skipIssue498(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue498 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue498 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue498 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue498(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue498 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue498 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue498 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue498 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue498 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue498 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue498 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue498 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue503/issue503.pb.go b/test/issue503/issue503.pb.go index c7cdc8ccf9..e15b91ef99 100644 --- a/test/issue503/issue503.pb.go +++ b/test/issue503/issue503.pb.go @@ -755,6 +755,7 @@ func (m *Foo) Unmarshal(dAtA []byte) error { func skipIssue503(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -786,10 +787,8 @@ func skipIssue503(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -810,55 +809,30 @@ func skipIssue503(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue503 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue503 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue503 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue503(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue503 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue503 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue503 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue503 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue503 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue503 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue503 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue503 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue530/issue530.pb.go b/test/issue530/issue530.pb.go index ba07be2eed..63508479e6 100644 --- a/test/issue530/issue530.pb.go +++ b/test/issue530/issue530.pb.go @@ -3665,6 +3665,7 @@ func (m *Bar9) Unmarshal(dAtA []byte) error { func skipIssue530(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3696,10 +3697,8 @@ func skipIssue530(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3720,55 +3719,30 @@ func skipIssue530(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue530 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue530 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue530 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue530(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue530 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue530 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue530 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue530 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue530 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue530 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue530 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue530 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue617/issue617.pb.go b/test/issue617/issue617.pb.go index 3f8ee6597d..4763a89836 100644 --- a/test/issue617/issue617.pb.go +++ b/test/issue617/issue617.pb.go @@ -444,6 +444,7 @@ func (m *Foo_Bar) Unmarshal(dAtA []byte) error { func skipIssue617(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -475,10 +476,8 @@ func skipIssue617(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -499,55 +498,30 @@ func skipIssue617(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthIssue617 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue617 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIssue617 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIssue617(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIssue617 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIssue617 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthIssue617 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthIssue617 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIssue617 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthIssue617 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIssue617 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIssue617 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/issue8/proto.pb.go b/test/issue8/proto.pb.go index f615e60e05..36472aa8e7 100644 --- a/test/issue8/proto.pb.go +++ b/test/issue8/proto.pb.go @@ -276,6 +276,7 @@ func (m *Foo) Unmarshal(dAtA []byte) error { func skipProto(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -307,10 +308,8 @@ func skipProto(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -331,55 +330,30 @@ func skipProto(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProto } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProto - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProto - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProto + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProto + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProto = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/mapdefaults/combos/both/map.pb.go b/test/mapdefaults/combos/both/map.pb.go index 713e34af36..d09386413f 100644 --- a/test/mapdefaults/combos/both/map.pb.go +++ b/test/mapdefaults/combos/both/map.pb.go @@ -1544,6 +1544,7 @@ func (m *FakeMapEntry) Unmarshal(dAtA []byte) error { func skipMap(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1575,10 +1576,8 @@ func skipMap(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1599,55 +1598,30 @@ func skipMap(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthMap } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthMap - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMap - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMap(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthMap - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMap + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthMap + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthMap = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMap = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthMap = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMap = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMap = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/mapdefaults/combos/unmarshaler/map.pb.go b/test/mapdefaults/combos/unmarshaler/map.pb.go index c36cc5084e..fbbc32e8be 100644 --- a/test/mapdefaults/combos/unmarshaler/map.pb.go +++ b/test/mapdefaults/combos/unmarshaler/map.pb.go @@ -1371,6 +1371,7 @@ func (m *FakeMapEntry) Unmarshal(dAtA []byte) error { func skipMap(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1402,10 +1403,8 @@ func skipMap(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1426,55 +1425,30 @@ func skipMap(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthMap } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthMap - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMap - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMap(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthMap - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMap + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthMap + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthMap = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMap = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthMap = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMap = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMap = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/mapsproto2/combos/both/mapsproto2.pb.go b/test/mapsproto2/combos/both/mapsproto2.pb.go index c8429dfcad..0b7ae4a78c 100644 --- a/test/mapsproto2/combos/both/mapsproto2.pb.go +++ b/test/mapsproto2/combos/both/mapsproto2.pb.go @@ -8907,6 +8907,7 @@ func (m *AllMapsOrdered) Unmarshal(dAtA []byte) error { func skipMapsproto2(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -8938,10 +8939,8 @@ func skipMapsproto2(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -8962,55 +8961,30 @@ func skipMapsproto2(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthMapsproto2 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthMapsproto2 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMapsproto2 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMapsproto2(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthMapsproto2 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMapsproto2 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthMapsproto2 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthMapsproto2 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMapsproto2 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthMapsproto2 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMapsproto2 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMapsproto2 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/mapsproto2/combos/unmarshaler/mapsproto2.pb.go b/test/mapsproto2/combos/unmarshaler/mapsproto2.pb.go index db2c8f832a..b0cc8bb233 100644 --- a/test/mapsproto2/combos/unmarshaler/mapsproto2.pb.go +++ b/test/mapsproto2/combos/unmarshaler/mapsproto2.pb.go @@ -7955,6 +7955,7 @@ func (m *AllMapsOrdered) Unmarshal(dAtA []byte) error { func skipMapsproto2(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -7986,10 +7987,8 @@ func skipMapsproto2(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -8010,55 +8009,30 @@ func skipMapsproto2(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthMapsproto2 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthMapsproto2 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMapsproto2 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMapsproto2(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthMapsproto2 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMapsproto2 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthMapsproto2 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthMapsproto2 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMapsproto2 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthMapsproto2 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMapsproto2 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMapsproto2 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/nopackage/nopackage.pb.go b/test/nopackage/nopackage.pb.go index 769fb0a81e..a7d1dc715d 100644 --- a/test/nopackage/nopackage.pb.go +++ b/test/nopackage/nopackage.pb.go @@ -335,6 +335,7 @@ func (m *M) Unmarshal(dAtA []byte) error { func skipNopackage(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -366,10 +367,8 @@ func skipNopackage(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -390,55 +389,30 @@ func skipNopackage(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthNopackage } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthNopackage - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNopackage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipNopackage(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthNopackage - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNopackage + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthNopackage + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthNopackage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNopackage = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthNopackage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNopackage = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNopackage = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/oneof/combos/both/one.pb.go b/test/oneof/combos/both/one.pb.go index 742c6c9e53..faf9e2584e 100644 --- a/test/oneof/combos/both/one.pb.go +++ b/test/oneof/combos/both/one.pb.go @@ -6473,6 +6473,7 @@ func (m *CustomOneof) Unmarshal(dAtA []byte) error { func skipOne(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -6504,10 +6505,8 @@ func skipOne(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -6528,55 +6527,30 @@ func skipOne(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthOne } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOne - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipOne(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOne + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthOne + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOne = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/oneof/combos/unmarshaler/one.pb.go b/test/oneof/combos/unmarshaler/one.pb.go index 3af665c455..e993379340 100644 --- a/test/oneof/combos/unmarshaler/one.pb.go +++ b/test/oneof/combos/unmarshaler/one.pb.go @@ -5891,6 +5891,7 @@ func (m *CustomOneof) Unmarshal(dAtA []byte) error { func skipOne(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -5922,10 +5923,8 @@ func skipOne(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -5946,55 +5945,30 @@ func skipOne(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthOne } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOne - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipOne(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOne + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthOne + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOne = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/oneof3/combos/both/one.pb.go b/test/oneof3/combos/both/one.pb.go index d5f0b4c406..c70658c57d 100644 --- a/test/oneof3/combos/both/one.pb.go +++ b/test/oneof3/combos/both/one.pb.go @@ -3866,6 +3866,7 @@ func (m *SampleOneOf) Unmarshal(dAtA []byte) error { func skipOne(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3897,10 +3898,8 @@ func skipOne(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3921,55 +3920,30 @@ func skipOne(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthOne } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOne - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipOne(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOne + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthOne + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOne = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/oneof3/combos/unmarshaler/one.pb.go b/test/oneof3/combos/unmarshaler/one.pb.go index bd5aa7ba3c..5a3cbc25ff 100644 --- a/test/oneof3/combos/unmarshaler/one.pb.go +++ b/test/oneof3/combos/unmarshaler/one.pb.go @@ -3546,6 +3546,7 @@ func (m *SampleOneOf) Unmarshal(dAtA []byte) error { func skipOne(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3577,10 +3578,8 @@ func skipOne(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3601,55 +3600,30 @@ func skipOne(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthOne } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowOne - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipOne(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthOne - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOne + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthOne + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthOne = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOne = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOne = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/packed/packed.pb.go b/test/packed/packed.pb.go index 17ab26de6c..eb5400926e 100644 --- a/test/packed/packed.pb.go +++ b/test/packed/packed.pb.go @@ -4764,6 +4764,7 @@ func (m *NinRepPackedNativeUnsafe) Unmarshal(dAtA []byte) error { func skipPacked(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4795,10 +4796,8 @@ func skipPacked(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -4819,55 +4818,30 @@ func skipPacked(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthPacked } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthPacked - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPacked - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipPacked(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthPacked - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPacked + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthPacked + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthPacked = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPacked = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthPacked = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPacked = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPacked = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/protosize/protosize.pb.go b/test/protosize/protosize.pb.go index fce29a490a..b40179a85d 100644 --- a/test/protosize/protosize.pb.go +++ b/test/protosize/protosize.pb.go @@ -526,6 +526,7 @@ func (m *SizeMessage) Unmarshal(dAtA []byte) error { func skipProtosize(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -557,10 +558,8 @@ func skipProtosize(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -581,55 +580,30 @@ func skipProtosize(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProtosize } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProtosize - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProtosize - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProtosize(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProtosize - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProtosize + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProtosize + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProtosize = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProtosize = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProtosize = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProtosize = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProtosize = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/required/requiredexample.pb.go b/test/required/requiredexample.pb.go index 280fb4a988..444000a7a3 100644 --- a/test/required/requiredexample.pb.go +++ b/test/required/requiredexample.pb.go @@ -2223,6 +2223,7 @@ func (m *NestedNinOptNative) Unmarshal(dAtA []byte) error { func skipRequiredexample(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2254,10 +2255,8 @@ func skipRequiredexample(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2278,55 +2277,30 @@ func skipRequiredexample(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthRequiredexample } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRequiredexample - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRequiredexample - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipRequiredexample(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthRequiredexample - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRequiredexample + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthRequiredexample + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthRequiredexample = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRequiredexample = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthRequiredexample = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRequiredexample = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRequiredexample = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/sizeunderscore/sizeunderscore.pb.go b/test/sizeunderscore/sizeunderscore.pb.go index f52b349cc1..e51ca10ab6 100644 --- a/test/sizeunderscore/sizeunderscore.pb.go +++ b/test/sizeunderscore/sizeunderscore.pb.go @@ -473,6 +473,7 @@ func (m *SizeMessage) Unmarshal(dAtA []byte) error { func skipSizeunderscore(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -504,10 +505,8 @@ func skipSizeunderscore(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -528,55 +527,30 @@ func skipSizeunderscore(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthSizeunderscore } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthSizeunderscore - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSizeunderscore - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipSizeunderscore(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthSizeunderscore - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSizeunderscore + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthSizeunderscore + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthSizeunderscore = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSizeunderscore = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthSizeunderscore = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSizeunderscore = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSizeunderscore = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/theproto3/combos/both/theproto3.pb.go b/test/theproto3/combos/both/theproto3.pb.go index e044a6278a..7aa16af022 100644 --- a/test/theproto3/combos/both/theproto3.pb.go +++ b/test/theproto3/combos/both/theproto3.pb.go @@ -11819,6 +11819,7 @@ func (m *NotPacked) Unmarshal(dAtA []byte) error { func skipTheproto3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -11850,10 +11851,8 @@ func skipTheproto3(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -11874,55 +11873,30 @@ func skipTheproto3(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTheproto3 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTheproto3 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTheproto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTheproto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTheproto3 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTheproto3 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTheproto3 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTheproto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTheproto3 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTheproto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTheproto3 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTheproto3 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/theproto3/combos/unmarshaler/theproto3.pb.go b/test/theproto3/combos/unmarshaler/theproto3.pb.go index 56e6eee3d5..ad8deb358f 100644 --- a/test/theproto3/combos/unmarshaler/theproto3.pb.go +++ b/test/theproto3/combos/unmarshaler/theproto3.pb.go @@ -10496,6 +10496,7 @@ func (m *NotPacked) Unmarshal(dAtA []byte) error { func skipTheproto3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -10527,10 +10528,8 @@ func skipTheproto3(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -10551,55 +10550,30 @@ func skipTheproto3(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTheproto3 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTheproto3 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTheproto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTheproto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTheproto3 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTheproto3 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTheproto3 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTheproto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTheproto3 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTheproto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTheproto3 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTheproto3 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/typedecl/typedecl.pb.go b/test/typedecl/typedecl.pb.go index 568661eeda..b733d849db 100644 --- a/test/typedecl/typedecl.pb.go +++ b/test/typedecl/typedecl.pb.go @@ -945,6 +945,7 @@ func (m *Kept) Unmarshal(dAtA []byte) error { func skipTypedecl(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -976,10 +977,8 @@ func skipTypedecl(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1000,55 +999,30 @@ func skipTypedecl(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTypedecl } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTypedecl - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypedecl - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTypedecl(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTypedecl - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypedecl + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypedecl + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTypedecl = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypedecl = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTypedecl = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypedecl = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypedecl = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/typedecl_all/typedeclall.pb.go b/test/typedecl_all/typedeclall.pb.go index b140fb9649..545b11f8cd 100644 --- a/test/typedecl_all/typedeclall.pb.go +++ b/test/typedecl_all/typedeclall.pb.go @@ -945,6 +945,7 @@ func (m *Kept) Unmarshal(dAtA []byte) error { func skipTypedeclall(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -976,10 +977,8 @@ func skipTypedeclall(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1000,55 +999,30 @@ func skipTypedeclall(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTypedeclall } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTypedeclall - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypedeclall - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTypedeclall(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTypedeclall - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypedeclall + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypedeclall + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTypedeclall = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypedeclall = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTypedeclall = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypedeclall = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypedeclall = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/types/combos/both/types.pb.go b/test/types/combos/both/types.pb.go index e5d512d2d8..bcfa037e62 100644 --- a/test/types/combos/both/types.pb.go +++ b/test/types/combos/both/types.pb.go @@ -21393,6 +21393,7 @@ func (m *OneofStdTypes) Unmarshal(dAtA []byte) error { func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -21424,10 +21425,8 @@ func skipTypes(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -21448,55 +21447,30 @@ func skipTypes(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTypes } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTypes(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/types/combos/unmarshaler/types.pb.go b/test/types/combos/unmarshaler/types.pb.go index 25d910957d..29e89a7e6a 100644 --- a/test/types/combos/unmarshaler/types.pb.go +++ b/test/types/combos/unmarshaler/types.pb.go @@ -18390,6 +18390,7 @@ func (m *OneofStdTypes) Unmarshal(dAtA []byte) error { func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -18421,10 +18422,8 @@ func skipTypes(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -18445,55 +18444,30 @@ func skipTypes(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTypes } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTypes(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/unmarshalmerge/unmarshalmerge.pb.go b/test/unmarshalmerge/unmarshalmerge.pb.go index 32d718fa27..84db558e79 100644 --- a/test/unmarshalmerge/unmarshalmerge.pb.go +++ b/test/unmarshalmerge/unmarshalmerge.pb.go @@ -1509,6 +1509,7 @@ func (m *IntMerge) Unmarshal(dAtA []byte) error { func skipUnmarshalmerge(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1540,10 +1541,8 @@ func skipUnmarshalmerge(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1564,55 +1563,30 @@ func skipUnmarshalmerge(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthUnmarshalmerge } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthUnmarshalmerge - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowUnmarshalmerge - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipUnmarshalmerge(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthUnmarshalmerge - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupUnmarshalmerge + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthUnmarshalmerge + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthUnmarshalmerge = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowUnmarshalmerge = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthUnmarshalmerge = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowUnmarshalmerge = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupUnmarshalmerge = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/unrecognized/unrecognized.pb.go b/test/unrecognized/unrecognized.pb.go index 4522459c70..0029b38ffb 100644 --- a/test/unrecognized/unrecognized.pb.go +++ b/test/unrecognized/unrecognized.pb.go @@ -4441,6 +4441,7 @@ func (m *OldU) Unmarshal(dAtA []byte) error { func skipUnrecognized(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4472,10 +4473,8 @@ func skipUnrecognized(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -4496,55 +4495,30 @@ func skipUnrecognized(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthUnrecognized } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthUnrecognized - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowUnrecognized - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipUnrecognized(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthUnrecognized - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupUnrecognized + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthUnrecognized + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthUnrecognized = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowUnrecognized = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthUnrecognized = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowUnrecognized = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupUnrecognized = fmt.Errorf("proto: unexpected end of group") ) diff --git a/test/unrecognizedgroup/unrecognizedgroup.pb.go b/test/unrecognizedgroup/unrecognizedgroup.pb.go index 9bb6f20c9b..345059573a 100644 --- a/test/unrecognizedgroup/unrecognizedgroup.pb.go +++ b/test/unrecognizedgroup/unrecognizedgroup.pb.go @@ -1747,6 +1747,7 @@ func (m *A) Unmarshal(dAtA []byte) error { func skipUnrecognizedgroup(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1778,10 +1779,8 @@ func skipUnrecognizedgroup(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1802,55 +1801,30 @@ func skipUnrecognizedgroup(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthUnrecognizedgroup } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthUnrecognizedgroup - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowUnrecognizedgroup - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipUnrecognizedgroup(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthUnrecognizedgroup - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupUnrecognizedgroup + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthUnrecognizedgroup + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthUnrecognizedgroup = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowUnrecognizedgroup = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthUnrecognizedgroup = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowUnrecognizedgroup = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupUnrecognizedgroup = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/any.pb.go b/types/any.pb.go index 3074a3d8a0..98e269d543 100644 --- a/types/any.pb.go +++ b/types/any.pb.go @@ -614,6 +614,7 @@ func (m *Any) Unmarshal(dAtA []byte) error { func skipAny(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -645,10 +646,8 @@ func skipAny(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -669,55 +668,30 @@ func skipAny(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthAny } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthAny - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAny - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipAny(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthAny - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAny + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthAny + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAny = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/api.pb.go b/types/api.pb.go index 61612e21a8..58bf4b53b3 100644 --- a/types/api.pb.go +++ b/types/api.pb.go @@ -2060,6 +2060,7 @@ func (m *Mixin) Unmarshal(dAtA []byte) error { func skipApi(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2091,10 +2092,8 @@ func skipApi(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2115,55 +2114,30 @@ func skipApi(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthApi } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthApi - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowApi - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipApi(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthApi - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupApi + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthApi + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupApi = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/duration.pb.go b/types/duration.pb.go index 32b957c2bd..3959f06690 100644 --- a/types/duration.pb.go +++ b/types/duration.pb.go @@ -437,6 +437,7 @@ func (m *Duration) Unmarshal(dAtA []byte) error { func skipDuration(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -468,10 +469,8 @@ func skipDuration(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -492,55 +491,30 @@ func skipDuration(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthDuration } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthDuration - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDuration - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipDuration(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthDuration - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDuration + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthDuration + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDuration = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/empty.pb.go b/types/empty.pb.go index b061be5e4b..17e3aa5583 100644 --- a/types/empty.pb.go +++ b/types/empty.pb.go @@ -382,6 +382,7 @@ func (m *Empty) Unmarshal(dAtA []byte) error { func skipEmpty(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -413,10 +414,8 @@ func skipEmpty(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -437,55 +436,30 @@ func skipEmpty(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthEmpty } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthEmpty - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEmpty - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEmpty(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthEmpty - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEmpty + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthEmpty + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEmpty = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/field_mask.pb.go b/types/field_mask.pb.go index 61ef57e2ca..7226b57f73 100644 --- a/types/field_mask.pb.go +++ b/types/field_mask.pb.go @@ -658,6 +658,7 @@ func (m *FieldMask) Unmarshal(dAtA []byte) error { func skipFieldMask(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -689,10 +690,8 @@ func skipFieldMask(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -713,55 +712,30 @@ func skipFieldMask(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthFieldMask } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthFieldMask - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowFieldMask - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipFieldMask(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthFieldMask - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFieldMask + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthFieldMask + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFieldMask = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/source_context.pb.go b/types/source_context.pb.go index 9b0752ed50..61045ce10d 100644 --- a/types/source_context.pb.go +++ b/types/source_context.pb.go @@ -444,6 +444,7 @@ func (m *SourceContext) Unmarshal(dAtA []byte) error { func skipSourceContext(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -475,10 +476,8 @@ func skipSourceContext(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -499,55 +498,30 @@ func skipSourceContext(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthSourceContext } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthSourceContext - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSourceContext - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipSourceContext(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthSourceContext - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSourceContext + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthSourceContext + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthSourceContext = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSourceContext = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthSourceContext = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSourceContext = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSourceContext = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/struct.pb.go b/types/struct.pb.go index 1266843845..cea553eef6 100644 --- a/types/struct.pb.go +++ b/types/struct.pb.go @@ -2197,6 +2197,7 @@ func (m *ListValue) Unmarshal(dAtA []byte) error { func skipStruct(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2228,10 +2229,8 @@ func skipStruct(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2252,55 +2251,30 @@ func skipStruct(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthStruct } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthStruct - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStruct - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipStruct(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthStruct - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStruct + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthStruct + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthStruct = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStruct = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthStruct = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStruct = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStruct = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/timestamp.pb.go b/types/timestamp.pb.go index bdbfe18c7b..b818752670 100644 --- a/types/timestamp.pb.go +++ b/types/timestamp.pb.go @@ -459,6 +459,7 @@ func (m *Timestamp) Unmarshal(dAtA []byte) error { func skipTimestamp(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -490,10 +491,8 @@ func skipTimestamp(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -514,55 +513,30 @@ func skipTimestamp(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthTimestamp } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthTimestamp - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTimestamp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTimestamp(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthTimestamp - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTimestamp + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthTimestamp + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTimestamp = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/type.pb.go b/types/type.pb.go index a3a4f354e9..13b7ec02f7 100644 --- a/types/type.pb.go +++ b/types/type.pb.go @@ -3287,6 +3287,7 @@ func (m *Option) Unmarshal(dAtA []byte) error { func skipType(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3318,10 +3319,8 @@ func skipType(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3342,55 +3341,30 @@ func skipType(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthType } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthType - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowType - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipType(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthType - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupType + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthType + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthType = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowType = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthType = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowType = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupType = fmt.Errorf("proto: unexpected end of group") ) diff --git a/types/wrappers.pb.go b/types/wrappers.pb.go index 5628dffa40..8f1edb57d3 100644 --- a/types/wrappers.pb.go +++ b/types/wrappers.pb.go @@ -2647,6 +2647,7 @@ func (m *BytesValue) Unmarshal(dAtA []byte) error { func skipWrappers(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -2678,10 +2679,8 @@ func skipWrappers(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -2702,55 +2701,30 @@ func skipWrappers(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthWrappers } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthWrappers - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWrappers - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipWrappers(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthWrappers - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWrappers + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthWrappers + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWrappers = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/fast/gogovanity.pb.go b/vanity/test/fast/gogovanity.pb.go index b55a07177b..2a2924a8e5 100644 --- a/vanity/test/fast/gogovanity.pb.go +++ b/vanity/test/fast/gogovanity.pb.go @@ -321,6 +321,7 @@ func (m *B) Unmarshal(dAtA []byte) error { func skipGogovanity(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -352,10 +353,8 @@ func skipGogovanity(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -376,55 +375,30 @@ func skipGogovanity(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthGogovanity } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthGogovanity - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipGogovanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthGogovanity - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGogovanity + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthGogovanity + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGogovanity = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/fast/proto3.pb.go b/vanity/test/fast/proto3.pb.go index 94252ac382..7d9f6b5dd5 100644 --- a/vanity/test/fast/proto3.pb.go +++ b/vanity/test/fast/proto3.pb.go @@ -241,6 +241,7 @@ func (m *Aproto3) Unmarshal(dAtA []byte) error { func skipProto3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -272,10 +273,8 @@ func skipProto3(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -296,55 +295,30 @@ func skipProto3(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProto3 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProto3 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProto3 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProto3 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProto3 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProto3 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/fast/vanity.pb.go b/vanity/test/fast/vanity.pb.go index 0bc25790d7..34b6e80ef1 100644 --- a/vanity/test/fast/vanity.pb.go +++ b/vanity/test/fast/vanity.pb.go @@ -287,6 +287,7 @@ func (m *A) Unmarshal(dAtA []byte) error { func skipVanity(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -318,10 +319,8 @@ func skipVanity(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -342,55 +341,30 @@ func skipVanity(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthVanity } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthVanity - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipVanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthVanity - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVanity + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthVanity + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVanity = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/faster/gogovanity.pb.go b/vanity/test/faster/gogovanity.pb.go index 67a01b30b6..a00e4163bd 100644 --- a/vanity/test/faster/gogovanity.pb.go +++ b/vanity/test/faster/gogovanity.pb.go @@ -306,6 +306,7 @@ func (m *B) Unmarshal(dAtA []byte) error { func skipGogovanity(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -337,10 +338,8 @@ func skipGogovanity(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -361,55 +360,30 @@ func skipGogovanity(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthGogovanity } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthGogovanity - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipGogovanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthGogovanity - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGogovanity + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthGogovanity + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGogovanity = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/faster/proto3.pb.go b/vanity/test/faster/proto3.pb.go index 6f6e54d810..4b6a0d8e0b 100644 --- a/vanity/test/faster/proto3.pb.go +++ b/vanity/test/faster/proto3.pb.go @@ -230,6 +230,7 @@ func (m *Aproto3) Unmarshal(dAtA []byte) error { func skipProto3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -261,10 +262,8 @@ func skipProto3(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -285,55 +284,30 @@ func skipProto3(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProto3 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProto3 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProto3 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProto3 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProto3 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProto3 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/faster/vanity.pb.go b/vanity/test/faster/vanity.pb.go index ea93803c9c..5380e22527 100644 --- a/vanity/test/faster/vanity.pb.go +++ b/vanity/test/faster/vanity.pb.go @@ -265,6 +265,7 @@ func (m *A) Unmarshal(dAtA []byte) error { func skipVanity(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -296,10 +297,8 @@ func skipVanity(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -320,55 +319,30 @@ func skipVanity(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthVanity } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthVanity - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipVanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthVanity - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVanity + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthVanity + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVanity = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/slick/gogovanity.pb.go b/vanity/test/slick/gogovanity.pb.go index 003aa3fd2e..bf5915fb81 100644 --- a/vanity/test/slick/gogovanity.pb.go +++ b/vanity/test/slick/gogovanity.pb.go @@ -395,6 +395,7 @@ func (m *B) Unmarshal(dAtA []byte) error { func skipGogovanity(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -426,10 +427,8 @@ func skipGogovanity(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -450,55 +449,30 @@ func skipGogovanity(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthGogovanity } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthGogovanity - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipGogovanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthGogovanity - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGogovanity + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthGogovanity + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGogovanity = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/slick/proto3.pb.go b/vanity/test/slick/proto3.pb.go index 6c5e00bea3..e8b034c7cd 100644 --- a/vanity/test/slick/proto3.pb.go +++ b/vanity/test/slick/proto3.pb.go @@ -293,6 +293,7 @@ func (m *Aproto3) Unmarshal(dAtA []byte) error { func skipProto3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -324,10 +325,8 @@ func skipProto3(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -348,55 +347,30 @@ func skipProto3(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthProto3 } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthProto3 - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthProto3 - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProto3 + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthProto3 + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProto3 = fmt.Errorf("proto: unexpected end of group") ) diff --git a/vanity/test/slick/vanity.pb.go b/vanity/test/slick/vanity.pb.go index 7c17b39094..88b55bf45a 100644 --- a/vanity/test/slick/vanity.pb.go +++ b/vanity/test/slick/vanity.pb.go @@ -333,6 +333,7 @@ func (m *A) Unmarshal(dAtA []byte) error { func skipVanity(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -364,10 +365,8 @@ func skipVanity(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -388,55 +387,30 @@ func skipVanity(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthVanity } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthVanity - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipVanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthVanity - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVanity + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthVanity + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVanity = fmt.Errorf("proto: unexpected end of group") )