From a35d5889f6215e0ab45f03066e87a56cc038ff67 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 26 Jan 2016 17:41:39 -0800 Subject: [PATCH] *: update gRPC, proto interface --- lease/leasepb/lease.pb.go | 62 ++++++-- raft/raftpb/raft.pb.go | 309 +++++++++++++++++++++++++++---------- snap/snappb/snap.pb.go | 63 ++++++-- storage/storagepb/kv.pb.go | 108 ++++++++++--- wal/walpb/record.pb.go | 96 +++++++++--- 5 files changed, 481 insertions(+), 157 deletions(-) diff --git a/lease/leasepb/lease.pb.go b/lease/leasepb/lease.pb.go index 3d14027b8..e5d40f37c 100644 --- a/lease/leasepb/lease.pb.go +++ b/lease/leasepb/lease.pb.go @@ -13,25 +13,33 @@ */ package leasepb -import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +import ( + "fmt" -// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto" + proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +) + +import math "math" import io "io" -import fmt "fmt" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf type Lease struct { - ID int64 `protobuf:"varint,1,opt,proto3" json:"ID,omitempty"` - TTL int64 `protobuf:"varint,2,opt,proto3" json:"TTL,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + TTL int64 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` } func (m *Lease) Reset() { *m = Lease{} } func (m *Lease) String() string { return proto.CompactTextString(m) } func (*Lease) ProtoMessage() {} +func init() { + proto.RegisterType((*Lease)(nil), "leasepb.Lease") +} func (m *Lease) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) @@ -116,8 +124,12 @@ func (m *Lease) 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 ErrIntOverflowLease + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -130,6 +142,12 @@ func (m *Lease) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Lease: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Lease: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -137,6 +155,9 @@ func (m *Lease) Unmarshal(data []byte) error { } m.ID = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -153,6 +174,9 @@ func (m *Lease) Unmarshal(data []byte) error { } m.TTL = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -164,15 +188,7 @@ func (m *Lease) Unmarshal(data []byte) error { } } default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipLease(data[iNdEx:]) if err != nil { return err @@ -187,6 +203,9 @@ func (m *Lease) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func skipLease(data []byte) (n int, err error) { @@ -195,6 +214,9 @@ func skipLease(data []byte) (n int, err error) { for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -208,7 +230,10 @@ func skipLease(data []byte) (n int, err error) { wireType := int(wire & 0x7) switch wireType { case 0: - for { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -224,6 +249,9 @@ func skipLease(data []byte) (n int, err error) { case 2: var length int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -244,6 +272,9 @@ func skipLease(data []byte) (n int, err error) { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -279,4 +310,5 @@ func skipLease(data []byte) (n int, err error) { var ( ErrInvalidLengthLease = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLease = fmt.Errorf("proto: integer overflow") ) diff --git a/raft/raftpb/raft.pb.go b/raft/raftpb/raft.pb.go index ff262eb3d..a3dba1ced 100644 --- a/raft/raftpb/raft.pb.go +++ b/raft/raftpb/raft.pb.go @@ -19,16 +19,19 @@ */ package raftpb -import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +import ( + "fmt" + + proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +) + import math "math" -// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto" - import io "io" -import fmt "fmt" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal +var _ = fmt.Errorf var _ = math.Inf type EntryType int32 @@ -167,10 +170,10 @@ func (x *ConfChangeType) UnmarshalJSON(data []byte) error { } type Entry struct { - Type EntryType `protobuf:"varint,1,opt,enum=raftpb.EntryType" json:"Type"` - Term uint64 `protobuf:"varint,2,opt" json:"Term"` - Index uint64 `protobuf:"varint,3,opt" json:"Index"` - Data []byte `protobuf:"bytes,4,opt" json:"Data,omitempty"` + Type EntryType `protobuf:"varint,1,opt,name=Type,enum=raftpb.EntryType" json:"Type"` + Term uint64 `protobuf:"varint,2,opt,name=Term" json:"Term"` + Index uint64 `protobuf:"varint,3,opt,name=Index" json:"Index"` + Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -239,10 +242,10 @@ func (m *ConfState) String() string { return proto.CompactTextString(m) } func (*ConfState) ProtoMessage() {} type ConfChange struct { - ID uint64 `protobuf:"varint,1,opt" json:"ID"` - Type ConfChangeType `protobuf:"varint,2,opt,enum=raftpb.ConfChangeType" json:"Type"` - NodeID uint64 `protobuf:"varint,3,opt" json:"NodeID"` - Context []byte `protobuf:"bytes,4,opt" json:"Context,omitempty"` + ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` + Type ConfChangeType `protobuf:"varint,2,opt,name=Type,enum=raftpb.ConfChangeType" json:"Type"` + NodeID uint64 `protobuf:"varint,3,opt,name=NodeID" json:"NodeID"` + Context []byte `protobuf:"bytes,4,opt,name=Context" json:"Context,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -251,6 +254,13 @@ func (m *ConfChange) String() string { return proto.CompactTextString(m) } func (*ConfChange) ProtoMessage() {} func init() { + proto.RegisterType((*Entry)(nil), "raftpb.Entry") + proto.RegisterType((*SnapshotMetadata)(nil), "raftpb.SnapshotMetadata") + proto.RegisterType((*Snapshot)(nil), "raftpb.Snapshot") + proto.RegisterType((*Message)(nil), "raftpb.Message") + proto.RegisterType((*HardState)(nil), "raftpb.HardState") + proto.RegisterType((*ConfState)(nil), "raftpb.ConfState") + proto.RegisterType((*ConfChange)(nil), "raftpb.ConfChange") proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value) proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value) proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) @@ -684,8 +694,12 @@ func (m *Entry) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -698,6 +712,12 @@ func (m *Entry) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Entry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -705,6 +725,9 @@ func (m *Entry) Unmarshal(data []byte) error { } m.Type = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -721,6 +744,9 @@ func (m *Entry) Unmarshal(data []byte) error { } m.Term = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -737,6 +763,9 @@ func (m *Entry) Unmarshal(data []byte) error { } m.Index = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -753,6 +782,9 @@ func (m *Entry) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -770,18 +802,13 @@ func (m *Entry) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append([]byte{}, data[iNdEx:postIndex]...) + m.Data = append(m.Data[:0], data[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } iNdEx = postIndex default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -797,14 +824,21 @@ func (m *Entry) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *SnapshotMetadata) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -817,6 +851,12 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 2 { @@ -824,6 +864,9 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } var msglen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -851,6 +894,9 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } m.Index = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -867,6 +913,9 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } m.Term = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -878,15 +927,7 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } } default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -902,14 +943,21 @@ func (m *SnapshotMetadata) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *Snapshot) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -922,6 +970,12 @@ func (m *Snapshot) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 2 { @@ -929,6 +983,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -946,7 +1003,10 @@ func (m *Snapshot) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append([]byte{}, data[iNdEx:postIndex]...) + m.Data = append(m.Data[:0], data[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -954,6 +1014,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } var msglen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -976,15 +1039,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { } iNdEx = postIndex default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -1000,14 +1055,21 @@ func (m *Snapshot) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *Message) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1020,6 +1082,12 @@ func (m *Message) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -1027,6 +1095,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.Type = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1043,6 +1114,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.To = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1059,6 +1133,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.From = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1075,6 +1152,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.Term = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1091,6 +1171,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.LogTerm = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1107,6 +1190,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.Index = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1123,6 +1209,9 @@ func (m *Message) Unmarshal(data []byte) error { } var msglen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1151,6 +1240,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.Commit = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1167,6 +1259,9 @@ func (m *Message) Unmarshal(data []byte) error { } var msglen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1194,6 +1289,9 @@ func (m *Message) Unmarshal(data []byte) error { } var v int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1211,6 +1309,9 @@ func (m *Message) Unmarshal(data []byte) error { } m.RejectHint = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1222,15 +1323,7 @@ func (m *Message) Unmarshal(data []byte) error { } } default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -1246,14 +1339,21 @@ func (m *Message) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *HardState) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1266,6 +1366,12 @@ func (m *HardState) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HardState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HardState: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -1273,6 +1379,9 @@ func (m *HardState) Unmarshal(data []byte) error { } m.Term = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1289,6 +1398,9 @@ func (m *HardState) Unmarshal(data []byte) error { } m.Vote = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1305,6 +1417,9 @@ func (m *HardState) Unmarshal(data []byte) error { } m.Commit = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1316,15 +1431,7 @@ func (m *HardState) Unmarshal(data []byte) error { } } default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -1340,14 +1447,21 @@ func (m *HardState) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *ConfState) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1360,6 +1474,12 @@ func (m *ConfState) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfState: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -1367,6 +1487,9 @@ func (m *ConfState) Unmarshal(data []byte) error { } var v uint64 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1379,15 +1502,7 @@ func (m *ConfState) Unmarshal(data []byte) error { } m.Nodes = append(m.Nodes, v) default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -1403,14 +1518,21 @@ func (m *ConfState) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *ConfChange) 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 ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1423,6 +1545,12 @@ func (m *ConfChange) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfChange: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -1430,6 +1558,9 @@ func (m *ConfChange) Unmarshal(data []byte) error { } m.ID = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1446,6 +1577,9 @@ func (m *ConfChange) Unmarshal(data []byte) error { } m.Type = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1462,6 +1596,9 @@ func (m *ConfChange) Unmarshal(data []byte) error { } m.NodeID = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1478,6 +1615,9 @@ func (m *ConfChange) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaft + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -1495,18 +1635,13 @@ func (m *ConfChange) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Context = append([]byte{}, data[iNdEx:postIndex]...) + m.Context = append(m.Context[:0], data[iNdEx:postIndex]...) + if m.Context == nil { + m.Context = []byte{} + } iNdEx = postIndex default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRaft(data[iNdEx:]) if err != nil { return err @@ -1522,6 +1657,9 @@ func (m *ConfChange) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func skipRaft(data []byte) (n int, err error) { @@ -1530,6 +1668,9 @@ func skipRaft(data []byte) (n int, err error) { for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaft + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -1543,7 +1684,10 @@ func skipRaft(data []byte) (n int, err error) { wireType := int(wire & 0x7) switch wireType { case 0: - for { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaft + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -1559,6 +1703,9 @@ func skipRaft(data []byte) (n int, err error) { case 2: var length int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaft + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -1579,6 +1726,9 @@ func skipRaft(data []byte) (n int, err error) { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaft + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -1614,4 +1764,5 @@ func skipRaft(data []byte) (n int, err error) { var ( ErrInvalidLengthRaft = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRaft = fmt.Errorf("proto: integer overflow") ) diff --git a/snap/snappb/snap.pb.go b/snap/snappb/snap.pb.go index 35fa8101c..12a17ed67 100644 --- a/snap/snappb/snap.pb.go +++ b/snap/snappb/snap.pb.go @@ -13,16 +13,19 @@ */ package snappb -import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +import ( + "fmt" + + proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +) + import math "math" -// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto" - import io "io" -import fmt "fmt" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal +var _ = fmt.Errorf var _ = math.Inf type Snapshot struct { @@ -35,6 +38,9 @@ func (m *Snapshot) Reset() { *m = Snapshot{} } func (m *Snapshot) String() string { return proto.CompactTextString(m) } func (*Snapshot) ProtoMessage() {} +func init() { + proto.RegisterType((*Snapshot)(nil), "snappb.snapshot") +} func (m *Snapshot) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) @@ -123,8 +129,12 @@ func (m *Snapshot) 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 ErrIntOverflowSnap + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -137,6 +147,12 @@ func (m *Snapshot) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: snapshot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: snapshot: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -144,6 +160,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } m.Crc = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnap + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -160,6 +179,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnap + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -177,18 +199,13 @@ func (m *Snapshot) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append([]byte{}, data[iNdEx:postIndex]...) + m.Data = append(m.Data[:0], data[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } iNdEx = postIndex default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipSnap(data[iNdEx:]) if err != nil { return err @@ -204,6 +221,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func skipSnap(data []byte) (n int, err error) { @@ -212,6 +232,9 @@ func skipSnap(data []byte) (n int, err error) { for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnap + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -225,7 +248,10 @@ func skipSnap(data []byte) (n int, err error) { wireType := int(wire & 0x7) switch wireType { case 0: - for { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnap + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -241,6 +267,9 @@ func skipSnap(data []byte) (n int, err error) { case 2: var length int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnap + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -261,6 +290,9 @@ func skipSnap(data []byte) (n int, err error) { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnap + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -296,4 +328,5 @@ func skipSnap(data []byte) (n int, err error) { var ( ErrInvalidLengthSnap = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSnap = fmt.Errorf("proto: integer overflow") ) diff --git a/storage/storagepb/kv.pb.go b/storage/storagepb/kv.pb.go index 971c312bc..b121c1791 100644 --- a/storage/storagepb/kv.pb.go +++ b/storage/storagepb/kv.pb.go @@ -14,15 +14,20 @@ */ package storagepb -import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +import ( + "fmt" -// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto" + proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +) + +import math "math" import io "io" -import fmt "fmt" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf type Event_EventType int32 @@ -79,6 +84,8 @@ func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func init() { + proto.RegisterType((*KeyValue)(nil), "storagepb.KeyValue") + proto.RegisterType((*Event)(nil), "storagepb.Event") proto.RegisterEnum("storagepb.Event_EventType", Event_EventType_name, Event_EventType_value) } func (m *KeyValue) Marshal() (data []byte, err error) { @@ -255,8 +262,12 @@ func (m *KeyValue) 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 ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -269,6 +280,12 @@ func (m *KeyValue) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KeyValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 2 { @@ -276,6 +293,9 @@ func (m *KeyValue) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -293,7 +313,10 @@ func (m *KeyValue) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = append([]byte{}, data[iNdEx:postIndex]...) + m.Key = append(m.Key[:0], data[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } iNdEx = postIndex case 2: if wireType != 0 { @@ -301,6 +324,9 @@ func (m *KeyValue) Unmarshal(data []byte) error { } m.CreateRevision = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -317,6 +343,9 @@ func (m *KeyValue) Unmarshal(data []byte) error { } m.ModRevision = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -333,6 +362,9 @@ func (m *KeyValue) Unmarshal(data []byte) error { } m.Version = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -349,6 +381,9 @@ func (m *KeyValue) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -366,7 +401,10 @@ func (m *KeyValue) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = append([]byte{}, data[iNdEx:postIndex]...) + m.Value = append(m.Value[:0], data[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } iNdEx = postIndex case 6: if wireType != 0 { @@ -374,6 +412,9 @@ func (m *KeyValue) Unmarshal(data []byte) error { } m.Lease = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -385,15 +426,7 @@ func (m *KeyValue) Unmarshal(data []byte) error { } } default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipKv(data[iNdEx:]) if err != nil { return err @@ -408,14 +441,21 @@ func (m *KeyValue) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *Event) 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 ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -428,6 +468,12 @@ func (m *Event) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Event: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -435,6 +481,9 @@ func (m *Event) Unmarshal(data []byte) error { } m.Type = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -451,6 +500,9 @@ func (m *Event) Unmarshal(data []byte) error { } var msglen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKv + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -476,15 +528,7 @@ func (m *Event) Unmarshal(data []byte) error { } iNdEx = postIndex default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipKv(data[iNdEx:]) if err != nil { return err @@ -499,6 +543,9 @@ func (m *Event) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func skipKv(data []byte) (n int, err error) { @@ -507,6 +554,9 @@ func skipKv(data []byte) (n int, err error) { for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKv + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -520,7 +570,10 @@ func skipKv(data []byte) (n int, err error) { wireType := int(wire & 0x7) switch wireType { case 0: - for { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKv + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -536,6 +589,9 @@ func skipKv(data []byte) (n int, err error) { case 2: var length int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKv + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -556,6 +612,9 @@ func skipKv(data []byte) (n int, err error) { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKv + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -591,4 +650,5 @@ func skipKv(data []byte) (n int, err error) { var ( ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowKv = fmt.Errorf("proto: integer overflow") ) diff --git a/wal/walpb/record.pb.go b/wal/walpb/record.pb.go index 9749b08e5..85ed1c0ac 100644 --- a/wal/walpb/record.pb.go +++ b/wal/walpb/record.pb.go @@ -14,16 +14,19 @@ */ package walpb -import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +import ( + "fmt" + + proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto" +) + import math "math" -// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto" - import io "io" -import fmt "fmt" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal +var _ = fmt.Errorf var _ = math.Inf type Record struct { @@ -47,6 +50,10 @@ func (m *Snapshot) Reset() { *m = Snapshot{} } func (m *Snapshot) String() string { return proto.CompactTextString(m) } func (*Snapshot) ProtoMessage() {} +func init() { + proto.RegisterType((*Record)(nil), "walpb.Record") + proto.RegisterType((*Snapshot)(nil), "walpb.Snapshot") +} func (m *Record) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) @@ -177,8 +184,12 @@ func (m *Record) 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 ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -191,6 +202,12 @@ func (m *Record) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Record: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -198,6 +215,9 @@ func (m *Record) Unmarshal(data []byte) error { } m.Type = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -214,6 +234,9 @@ func (m *Record) Unmarshal(data []byte) error { } m.Crc = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -230,6 +253,9 @@ func (m *Record) Unmarshal(data []byte) error { } var byteLen int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -247,18 +273,13 @@ func (m *Record) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append([]byte{}, data[iNdEx:postIndex]...) + m.Data = append(m.Data[:0], data[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } iNdEx = postIndex default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRecord(data[iNdEx:]) if err != nil { return err @@ -274,14 +295,21 @@ func (m *Record) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func (m *Snapshot) 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 ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -294,6 +322,12 @@ func (m *Snapshot) Unmarshal(data []byte) error { } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) + } switch fieldNum { case 1: if wireType != 0 { @@ -301,6 +335,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } m.Index = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -317,6 +354,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } m.Term = 0 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } if iNdEx >= l { return io.ErrUnexpectedEOF } @@ -328,15 +368,7 @@ func (m *Snapshot) Unmarshal(data []byte) error { } } default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire + iNdEx = preIndex skippy, err := skipRecord(data[iNdEx:]) if err != nil { return err @@ -352,6 +384,9 @@ func (m *Snapshot) Unmarshal(data []byte) error { } } + if iNdEx > l { + return io.ErrUnexpectedEOF + } return nil } func skipRecord(data []byte) (n int, err error) { @@ -360,6 +395,9 @@ func skipRecord(data []byte) (n int, err error) { for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRecord + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -373,7 +411,10 @@ func skipRecord(data []byte) (n int, err error) { wireType := int(wire & 0x7) switch wireType { case 0: - for { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRecord + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -389,6 +430,9 @@ func skipRecord(data []byte) (n int, err error) { case 2: var length int for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRecord + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -409,6 +453,9 @@ func skipRecord(data []byte) (n int, err error) { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRecord + } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } @@ -444,4 +491,5 @@ func skipRecord(data []byte) (n int, err error) { var ( ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow") )