Merge pull request #804 from filecoin-project/fix/retrieve-large

Fix retrieval of large files
This commit is contained in:
Łukasz Magiera 2019-12-09 16:28:47 +01:00 committed by GitHub
commit 0b4db5530c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 159 additions and 124 deletions

View File

@ -105,7 +105,8 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Vouchers: array too large (%d)", extra) return fmt.Errorf("t.Vouchers: array too large (%d)", extra)
} }
@ -244,7 +245,8 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Refs: array too large (%d)", extra) return fmt.Errorf("t.Refs: array too large (%d)", extra)
} }

View File

@ -136,10 +136,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Params: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -611,10 +611,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.CommR: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.CommR: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -638,7 +638,8 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra) return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
} }
@ -863,10 +864,10 @@ func (t *SubmitFallbackPoStParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -880,7 +881,8 @@ func (t *SubmitFallbackPoStParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Candidates: array too large (%d)", extra) return fmt.Errorf("t.Candidates: array too large (%d)", extra)
} }
@ -951,10 +953,10 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Extra: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Extra: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -968,10 +970,10 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -1106,7 +1108,8 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Signers: array too large (%d)", extra) return fmt.Errorf("t.Signers: array too large (%d)", extra)
} }
@ -1181,7 +1184,8 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Transactions: array too large (%d)", extra) return fmt.Errorf("t.Transactions: array too large (%d)", extra)
} }
@ -1256,7 +1260,8 @@ func (t *MultiSigConstructorParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Signers: array too large (%d)", extra) return fmt.Errorf("t.Signers: array too large (%d)", extra)
} }
@ -1382,10 +1387,10 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Params: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -1679,10 +1684,10 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Params: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -1696,7 +1701,8 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Approved: array too large (%d)", extra) return fmt.Errorf("t.Approved: array too large (%d)", extra)
} }
@ -2260,10 +2266,10 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Secret: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Secret: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -2277,10 +2283,10 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -2397,7 +2403,8 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Vouchers: array too large (%d)", extra) return fmt.Errorf("t.Vouchers: array too large (%d)", extra)
} }
@ -3239,10 +3246,10 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.PieceRef: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.PieceRef: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -3461,7 +3468,8 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Deals: array too large (%d)", extra) return fmt.Errorf("t.Deals: array too large (%d)", extra)
} }
@ -3526,7 +3534,8 @@ func (t *PublishStorageDealResponse) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra) return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
} }
@ -3595,7 +3604,8 @@ func (t *ActivateStorageDealsParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Deals: array too large (%d)", extra) return fmt.Errorf("t.Deals: array too large (%d)", extra)
} }
@ -3664,7 +3674,8 @@ func (t *ProcessStorageDealsPaymentParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra) return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
} }
@ -3796,7 +3807,8 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra) return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
} }
@ -3888,10 +3900,10 @@ func (t *SectorProveCommitInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -3915,7 +3927,8 @@ func (t *SectorProveCommitInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra) return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
} }

View File

@ -66,7 +66,8 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Start: array too large (%d)", extra) return fmt.Errorf("t.Start: array too large (%d)", extra)
} }
@ -163,7 +164,8 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Chain: array too large (%d)", extra) return fmt.Errorf("t.Chain: array too large (%d)", extra)
} }
@ -298,7 +300,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Blocks: array too large (%d)", extra) return fmt.Errorf("t.Blocks: array too large (%d)", extra)
} }
@ -324,7 +327,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) return fmt.Errorf("t.BlsMessages: array too large (%d)", extra)
} }
@ -350,7 +354,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMsgIncludes: array too large (%d)", extra) return fmt.Errorf("t.BlsMsgIncludes: array too large (%d)", extra)
} }
@ -370,7 +375,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMsgIncludes[i]: array too large (%d)", extra) return fmt.Errorf("t.BlsMsgIncludes[i]: array too large (%d)", extra)
} }
@ -403,7 +409,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra)
} }
@ -429,7 +436,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMsgIncludes: array too large (%d)", extra) return fmt.Errorf("t.SecpkMsgIncludes: array too large (%d)", extra)
} }
@ -449,7 +457,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMsgIncludes[i]: array too large (%d)", extra) return fmt.Errorf("t.SecpkMsgIncludes[i]: array too large (%d)", extra)
} }

View File

@ -153,7 +153,8 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Parents: array too large (%d)", extra) return fmt.Errorf("t.Parents: array too large (%d)", extra)
} }
@ -310,10 +311,10 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.VRFProof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.VRFProof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -382,10 +383,10 @@ func (t *EPostProof) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -399,10 +400,10 @@ func (t *EPostProof) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.PostRand: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.PostRand: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -416,7 +417,8 @@ func (t *EPostProof) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Candidates: array too large (%d)", extra) return fmt.Errorf("t.Candidates: array too large (%d)", extra)
} }
@ -489,10 +491,10 @@ func (t *EPostTicket) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Partial: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Partial: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -663,10 +665,10 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Params: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -895,10 +897,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.SecretPreimage: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.SecretPreimage: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -972,7 +974,8 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Merges: array too large (%d)", extra) return fmt.Errorf("t.Merges: array too large (%d)", extra)
} }
@ -1085,10 +1088,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Data: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Data: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -1315,10 +1318,10 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Return: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Return: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -1416,7 +1419,8 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) return fmt.Errorf("t.BlsMessages: array too large (%d)", extra)
} }
@ -1441,7 +1445,8 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra)
} }
@ -1718,7 +1723,8 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Cids: array too large (%d)", extra) return fmt.Errorf("t.Cids: array too large (%d)", extra)
} }
@ -1743,7 +1749,8 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Blocks: array too large (%d)", extra) return fmt.Errorf("t.Blocks: array too large (%d)", extra)
} }

2
go.mod
View File

@ -86,7 +86,7 @@ require (
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
github.com/stretchr/testify v1.4.0 github.com/stretchr/testify v1.4.0
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d github.com/whyrusleeping/cbor-gen v0.0.0-20191208220313-d43e400b4942
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d
go.opencensus.io v0.22.1 go.opencensus.io v0.22.1

2
go.sum
View File

@ -586,6 +586,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20190910031516-c1cbffdb01bb/go.mod h1:x
github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+b91GdXrp0AqsG7pspWV6CLk5Gk7i46L4tGo= github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+b91GdXrp0AqsG7pspWV6CLk5Gk7i46L4tGo=
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191208220313-d43e400b4942 h1:EIKesTogdQi76lVOmZleTRQtNNIXSy037QVBVMZ8rug=
github.com/whyrusleeping/cbor-gen v0.0.0-20191208220313-d43e400b4942/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=

View File

@ -79,10 +79,10 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -197,7 +197,8 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Vouchers: array too large (%d)", extra) return fmt.Errorf("t.Vouchers: array too large (%d)", extra)
} }

View File

@ -432,10 +432,10 @@ func (t *Block) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Prefix: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Prefix: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -449,10 +449,10 @@ func (t *Block) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Data: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Data: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }

View File

@ -67,10 +67,10 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.TicketBytes: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.TicketBytes: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -136,10 +136,10 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.TicketBytes: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.TicketBytes: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -220,10 +220,10 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.CommP: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.CommP: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -403,7 +403,8 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Pieces: array too large (%d)", extra) return fmt.Errorf("t.Pieces: array too large (%d)", extra)
} }
@ -429,10 +430,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Pad0: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Pad0: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -446,10 +447,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.CommD: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.CommD: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -463,10 +464,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.CommR: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.CommR: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -480,10 +481,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Pad1: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Pad1: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -497,10 +498,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }