diff --git a/ledger/store/trackerdb/generickv/msgp_gen.go b/ledger/store/trackerdb/generickv/msgp_gen.go index 4f5cba66b1..f7bc3a2d83 100644 --- a/ledger/store/trackerdb/generickv/msgp_gen.go +++ b/ledger/store/trackerdb/generickv/msgp_gen.go @@ -13,6 +13,7 @@ import ( // |-----> (*) MarshalMsg // |-----> (*) CanMarshalMsg // |-----> (*) UnmarshalMsg +// |-----> (*) UnmarshalValidateMsg // |-----> (*) CanUnmarshalMsg // |-----> (*) Msgsize // |-----> (*) MsgIsZero @@ -56,11 +57,15 @@ func (_ *creatableEntry) CanMarshalMsg(z interface{}) bool { } // UnmarshalMsg implements msgp.Unmarshaler -func (z *creatableEntry) UnmarshalMsg(bts []byte) (o []byte, err error) { +func (z *creatableEntry) unmarshalMsg(bts []byte, validate bool) (o []byte, err error) { var field []byte _ = field var zb0001 int + var zb0003 string + var zb0004 bool var zb0002 bool + _ = zb0003 + _ = zb0004 zb0001, zb0002, bts, err = msgp.ReadMapHeaderBytes(bts) if _, ok := err.(msgp.TypeError); ok { zb0001, zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) @@ -68,6 +73,10 @@ func (z *creatableEntry) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err) return } + if validate { + err = &msgp.ErrNonCanonical{} + return + } if zb0001 > 0 { zb0001-- bts, err = (*z).Ctype.UnmarshalMsg(bts) @@ -108,17 +117,27 @@ func (z *creatableEntry) UnmarshalMsg(bts []byte) (o []byte, err error) { } switch string(field) { case "Ctype": + if validate && zb0004 && "Ctype" < zb0003 { + err = &msgp.ErrNonCanonical{} + return + } bts, err = (*z).Ctype.UnmarshalMsg(bts) if err != nil { err = msgp.WrapError(err, "Ctype") return } + zb0003 = "Ctype" case "CreatorAddr": + if validate && zb0004 && "CreatorAddr" < zb0003 { + err = &msgp.ErrNonCanonical{} + return + } (*z).CreatorAddr, bts, err = msgp.ReadBytesBytes(bts, (*z).CreatorAddr) if err != nil { err = msgp.WrapError(err, "CreatorAddr") return } + zb0003 = "CreatorAddr" default: err = msgp.ErrNoField(string(field)) if err != nil { @@ -126,12 +145,19 @@ func (z *creatableEntry) UnmarshalMsg(bts []byte) (o []byte, err error) { return } } + zb0004 = true } } o = bts return } +func (z *creatableEntry) UnmarshalMsg(bts []byte) (o []byte, err error) { + return z.unmarshalMsg(bts, false) +} +func (z *creatableEntry) UnmarshalValidateMsg(bts []byte) (o []byte, err error) { + return z.unmarshalMsg(bts, true) +} func (_ *creatableEntry) CanUnmarshalMsg(z interface{}) bool { _, ok := (z).(*creatableEntry) return ok diff --git a/node/msgp_gen.go b/node/msgp_gen.go index 33beb7a29c..9afdfa32b1 100644 --- a/node/msgp_gen.go +++ b/node/msgp_gen.go @@ -87,8 +87,8 @@ func (z *netPrioResponse) unmarshalMsg(bts []byte, validate bool) (o []byte, err err = msgp.WrapError(err, "struct-from-array", "Nonce") return } - if zb0005 > netPrioChallengeSize { - err = msgp.ErrOverflow(uint64(zb0005), uint64(netPrioChallengeSize)) + if zb0005 > netPrioChallengeSizeBase64Encoded { + err = msgp.ErrOverflow(uint64(zb0005), uint64(netPrioChallengeSizeBase64Encoded)) return } (*z).Nonce, bts, err = msgp.ReadStringBytes(bts) @@ -131,8 +131,8 @@ func (z *netPrioResponse) unmarshalMsg(bts []byte, validate bool) (o []byte, err err = msgp.WrapError(err, "Nonce") return } - if zb0006 > netPrioChallengeSize { - err = msgp.ErrOverflow(uint64(zb0006), uint64(netPrioChallengeSize)) + if zb0006 > netPrioChallengeSizeBase64Encoded { + err = msgp.ErrOverflow(uint64(zb0006), uint64(netPrioChallengeSizeBase64Encoded)) return } (*z).Nonce, bts, err = msgp.ReadStringBytes(bts) @@ -298,8 +298,8 @@ func (z *netPrioResponseSigned) unmarshalMsg(bts []byte, validate bool) (o []byt err = msgp.WrapError(err, "struct-from-array", "Response", "struct-from-array", "Nonce") return } - if zb0009 > netPrioChallengeSize { - err = msgp.ErrOverflow(uint64(zb0009), uint64(netPrioChallengeSize)) + if zb0009 > netPrioChallengeSizeBase64Encoded { + err = msgp.ErrOverflow(uint64(zb0009), uint64(netPrioChallengeSizeBase64Encoded)) return } (*z).Response.Nonce, bts, err = msgp.ReadStringBytes(bts) @@ -342,8 +342,8 @@ func (z *netPrioResponseSigned) unmarshalMsg(bts []byte, validate bool) (o []byt err = msgp.WrapError(err, "struct-from-array", "Response", "Nonce") return } - if zb0010 > netPrioChallengeSize { - err = msgp.ErrOverflow(uint64(zb0010), uint64(netPrioChallengeSize)) + if zb0010 > netPrioChallengeSizeBase64Encoded { + err = msgp.ErrOverflow(uint64(zb0010), uint64(netPrioChallengeSizeBase64Encoded)) return } (*z).Response.Nonce, bts, err = msgp.ReadStringBytes(bts) @@ -440,8 +440,8 @@ func (z *netPrioResponseSigned) unmarshalMsg(bts []byte, validate bool) (o []byt err = msgp.WrapError(err, "Response", "struct-from-array", "Nonce") return } - if zb0015 > netPrioChallengeSize { - err = msgp.ErrOverflow(uint64(zb0015), uint64(netPrioChallengeSize)) + if zb0015 > netPrioChallengeSizeBase64Encoded { + err = msgp.ErrOverflow(uint64(zb0015), uint64(netPrioChallengeSizeBase64Encoded)) return } (*z).Response.Nonce, bts, err = msgp.ReadStringBytes(bts) @@ -484,8 +484,8 @@ func (z *netPrioResponseSigned) unmarshalMsg(bts []byte, validate bool) (o []byt err = msgp.WrapError(err, "Response", "Nonce") return } - if zb0016 > netPrioChallengeSize { - err = msgp.ErrOverflow(uint64(zb0016), uint64(netPrioChallengeSize)) + if zb0016 > netPrioChallengeSizeBase64Encoded { + err = msgp.ErrOverflow(uint64(zb0016), uint64(netPrioChallengeSizeBase64Encoded)) return } (*z).Response.Nonce, bts, err = msgp.ReadStringBytes(bts)