From 4e122537c7c45290272c35721e38c95d9c8ae218 Mon Sep 17 00:00:00 2001
From: Fu Juntang <StrongTiger_001@163.com>
Date: 星期五, 03 九月 2021 12:17:36 +0800
Subject: [PATCH] Verify the seriliazed parameters parsing logic.
---
proto/source/bhome_msg/error_msg.pb.go | 344 ++++----------------------------------------------------
1 files changed, 29 insertions(+), 315 deletions(-)
diff --git a/proto/source/bhome_msg/error_msg.pb.go b/proto/source/bhome_msg/error_msg.pb.go
index 6a13b8b..ee11854 100644
--- a/proto/source/bhome_msg/error_msg.pb.go
+++ b/proto/source/bhome_msg/error_msg.pb.go
@@ -1,14 +1,12 @@
-// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// Code generated by protoc-gen-go. DO NOT EDIT.
// source: error_msg.proto
package bhome_msg
import (
fmt "fmt"
- proto "github.com/gogo/protobuf/proto"
- io "io"
+ proto "github.com/golang/protobuf/proto"
math "math"
- math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -20,7 +18,7 @@
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
-const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type ErrorCode int32
@@ -66,8 +64,11 @@
}
type ErrorMsg struct {
- ErrCode ErrorCode `protobuf:"varint,1,opt,name=errCode,proto3,enum=bhome_msg.ErrorCode" json:"errCode,omitempty"`
- ErrString []byte `protobuf:"bytes,2,opt,name=errString,proto3" json:"errString,omitempty"`
+ ErrCode ErrorCode `protobuf:"varint,1,opt,name=errCode,proto3,enum=bhome_msg.ErrorCode" json:"errCode,omitempty"`
+ ErrString []byte `protobuf:"bytes,2,opt,name=errString,proto3" json:"errString,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
}
func (m *ErrorMsg) Reset() { *m = ErrorMsg{} }
@@ -76,26 +77,18 @@
func (*ErrorMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_da93925f7641a6e0, []int{0}
}
+
func (m *ErrorMsg) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
+ return xxx_messageInfo_ErrorMsg.Unmarshal(m, b)
}
func (m *ErrorMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_ErrorMsg.Marshal(b, m, deterministic)
- } else {
- b = b[:cap(b)]
- n, err := m.MarshalTo(b)
- if err != nil {
- return nil, err
- }
- return b[:n], nil
- }
+ return xxx_messageInfo_ErrorMsg.Marshal(b, m, deterministic)
}
func (m *ErrorMsg) XXX_Merge(src proto.Message) {
xxx_messageInfo_ErrorMsg.Merge(m, src)
}
func (m *ErrorMsg) XXX_Size() int {
- return m.Size()
+ return xxx_messageInfo_ErrorMsg.Size(m)
}
func (m *ErrorMsg) XXX_DiscardUnknown() {
xxx_messageInfo_ErrorMsg.DiscardUnknown(m)
@@ -125,300 +118,21 @@
func init() { proto.RegisterFile("error_msg.proto", fileDescriptor_da93925f7641a6e0) }
var fileDescriptor_da93925f7641a6e0 = []byte{
- // 274 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0xc1, 0x4a, 0xf3, 0x40,
- 0x10, 0x80, 0xb3, 0xed, 0xff, 0xb7, 0xcd, 0xd8, 0xc6, 0x75, 0xe9, 0xa1, 0x07, 0x59, 0x8a, 0x17,
- 0x8b, 0x87, 0x08, 0xfa, 0x04, 0x2a, 0x8a, 0x3d, 0x34, 0x42, 0x7a, 0x11, 0x2f, 0xd2, 0x66, 0xa7,
- 0x69, 0xa0, 0xdd, 0x0d, 0xb3, 0x1b, 0x5f, 0x43, 0x1f, 0xcb, 0x63, 0x8f, 0x1e, 0x25, 0x79, 0x11,
- 0x49, 0xc0, 0x78, 0xfd, 0xbe, 0x6f, 0x06, 0x66, 0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xa5, 0x5d, 0xbb, 0xba, 0x09, 0x7a,
+ 0x80, 0x08, 0x09, 0xa5, 0x1c, 0x32, 0x2a, 0x4a, 0x1f, 0x48, 0xc8, 0xea, 0x21, 0x4e, 0x21, 0x6e,
+ 0xd9, 0x2b, 0x37, 0xce, 0xea, 0xf3, 0x6e, 0xdf, 0xfb, 0xe1, 0x70, 0x2a, 0x1d, 0xe9, 0x0b, 0x4c,
+ 0x00, 0x28, 0xe5, 0x8c, 0x7c, 0xcd, 0xce, 0xea, 0x08, 0xe7, 0xa0, 0xe9, 0xd1, 0x5a, 0x21, 0xef,
+ 0x53, 0x0e, 0x9b, 0x5d, 0xc8, 0x8f, 0x7a, 0xf4, 0x34, 0x7b, 0x1b, 0x7e, 0x5e, 0x9a, 0xbb, 0xfe,
+ 0xa6, 0x7d, 0xd4, 0xbd, 0xe3, 0xe1, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x9d, 0x17, 0x3d, 0x21,
+ 0x01, 0x00, 0x00,
}
-
-func (m *ErrorMsg) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalTo(dAtA)
- if err != nil {
- return nil, err
- }
- return dAtA[:n], nil
-}
-
-func (m *ErrorMsg) MarshalTo(dAtA []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ErrCode != 0 {
- dAtA[i] = 0x8
- i++
- i = encodeVarintErrorMsg(dAtA, i, uint64(m.ErrCode))
- }
- if len(m.ErrString) > 0 {
- dAtA[i] = 0x12
- i++
- i = encodeVarintErrorMsg(dAtA, i, uint64(len(m.ErrString)))
- i += copy(dAtA[i:], m.ErrString)
- }
- return i, nil
-}
-
-func encodeVarintErrorMsg(dAtA []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- dAtA[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- dAtA[offset] = uint8(v)
- return offset + 1
-}
-func (m *ErrorMsg) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if m.ErrCode != 0 {
- n += 1 + sovErrorMsg(uint64(m.ErrCode))
- }
- l = len(m.ErrString)
- if l > 0 {
- n += 1 + l + sovErrorMsg(uint64(l))
- }
- return n
-}
-
-func sovErrorMsg(x uint64) (n int) {
- return (math_bits.Len64(x|1) + 6) / 7
-}
-func sozErrorMsg(x uint64) (n int) {
- return sovErrorMsg(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *ErrorMsg) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowErrorMsg
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ErrorMsg: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ErrorMsg: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ErrCode", wireType)
- }
- m.ErrCode = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowErrorMsg
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- m.ErrCode |= ErrorCode(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ErrString", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowErrorMsg
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- byteLen |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthErrorMsg
- }
- postIndex := iNdEx + byteLen
- if postIndex < 0 {
- return ErrInvalidLengthErrorMsg
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.ErrString = append(m.ErrString[:0], dAtA[iNdEx:postIndex]...)
- if m.ErrString == nil {
- m.ErrString = []byte{}
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipErrorMsg(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthErrorMsg
- }
- if (iNdEx + skippy) < 0 {
- return ErrInvalidLengthErrorMsg
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipErrorMsg(dAtA []byte) (n int, err error) {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowErrorMsg
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowErrorMsg
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if dAtA[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowErrorMsg
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if length < 0 {
- return 0, ErrInvalidLengthErrorMsg
- }
- iNdEx += length
- if iNdEx < 0 {
- return 0, ErrInvalidLengthErrorMsg
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowErrorMsg
- }
- 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 := skipErrorMsg(dAtA[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- if iNdEx < 0 {
- return 0, ErrInvalidLengthErrorMsg
- }
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthErrorMsg = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowErrorMsg = fmt.Errorf("proto: integer overflow")
-)
--
Gitblit v1.8.0