mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-22 23:03:29 +00:00
Security fix - containerd to 1.7.27
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
2
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
2
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
@ -51,6 +51,8 @@ type UnmarshalOptions struct {
|
||||
|
||||
// Unmarshal parses the wire-format message in b and places the result in m.
|
||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||
//
|
||||
// See the [UnmarshalOptions] type if you need more control.
|
||||
func Unmarshal(b []byte, m Message) error {
|
||||
_, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect())
|
||||
return err
|
||||
|
44
vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
44
vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
@ -5,12 +5,17 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/order"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
protoerrors "google.golang.org/protobuf/internal/errors"
|
||||
)
|
||||
|
||||
// MarshalOptions configures the marshaler.
|
||||
@ -70,7 +75,32 @@ type MarshalOptions struct {
|
||||
UseCachedSize bool
|
||||
}
|
||||
|
||||
// flags turns the specified MarshalOptions (user-facing) into
|
||||
// protoiface.MarshalInputFlags (used internally by the marshaler).
|
||||
//
|
||||
// See impl.marshalOptions.Options for the inverse operation.
|
||||
func (o MarshalOptions) flags() protoiface.MarshalInputFlags {
|
||||
var flags protoiface.MarshalInputFlags
|
||||
|
||||
// Note: o.AllowPartial is always forced to true by MarshalOptions.marshal,
|
||||
// which is why it is not a part of MarshalInputFlags.
|
||||
|
||||
if o.Deterministic {
|
||||
flags |= protoiface.MarshalDeterministic
|
||||
}
|
||||
|
||||
if o.UseCachedSize {
|
||||
flags |= protoiface.MarshalUseCachedSize
|
||||
}
|
||||
|
||||
return flags
|
||||
}
|
||||
|
||||
// Marshal returns the wire-format encoding of m.
|
||||
//
|
||||
// This is the most common entry point for encoding a Protobuf message.
|
||||
//
|
||||
// See the [MarshalOptions] type if you need more control.
|
||||
func Marshal(m Message) ([]byte, error) {
|
||||
// Treat nil message interface as an empty message; nothing to output.
|
||||
if m == nil {
|
||||
@ -116,6 +146,9 @@ func emptyBytesForMessage(m Message) []byte {
|
||||
|
||||
// MarshalAppend appends the wire-format encoding of m to b,
|
||||
// returning the result.
|
||||
//
|
||||
// This is a less common entry point than [Marshal], which is only needed if you
|
||||
// need to supply your own buffers for performance reasons.
|
||||
func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
|
||||
// Treat nil message interface as an empty message; nothing to append.
|
||||
if m == nil {
|
||||
@ -145,12 +178,7 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac
|
||||
in := protoiface.MarshalInput{
|
||||
Message: m,
|
||||
Buf: b,
|
||||
}
|
||||
if o.Deterministic {
|
||||
in.Flags |= protoiface.MarshalDeterministic
|
||||
}
|
||||
if o.UseCachedSize {
|
||||
in.Flags |= protoiface.MarshalUseCachedSize
|
||||
Flags: o.flags(),
|
||||
}
|
||||
if methods.Size != nil {
|
||||
sout := methods.Size(protoiface.SizeInput{
|
||||
@ -168,6 +196,10 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac
|
||||
out.Buf, err = o.marshalMessageSlow(b, m)
|
||||
}
|
||||
if err != nil {
|
||||
var mismatch *protoerrors.SizeMismatchError
|
||||
if errors.As(err, &mismatch) {
|
||||
return out, fmt.Errorf("marshaling %s: %v", string(m.Descriptor().FullName()), err)
|
||||
}
|
||||
return out, err
|
||||
}
|
||||
if allowPartial {
|
||||
|
9
vendor/google.golang.org/protobuf/proto/equal.go
generated
vendored
9
vendor/google.golang.org/protobuf/proto/equal.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
"reflect"
|
||||
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// Equal reports whether two messages are equal,
|
||||
@ -51,6 +52,14 @@ func Equal(x, y Message) bool {
|
||||
if mx.IsValid() != my.IsValid() {
|
||||
return false
|
||||
}
|
||||
|
||||
// Only one of the messages needs to implement the fast-path for it to work.
|
||||
pmx := protoMethods(mx)
|
||||
pmy := protoMethods(my)
|
||||
if pmx != nil && pmy != nil && pmx.Equal != nil && pmy.Equal != nil {
|
||||
return pmx.Equal(protoiface.EqualInput{MessageA: mx, MessageB: my}).Equal
|
||||
}
|
||||
|
||||
vx := protoreflect.ValueOfMessage(mx)
|
||||
vy := protoreflect.ValueOfMessage(my)
|
||||
return vx.Equal(vy)
|
||||
|
88
vendor/google.golang.org/protobuf/proto/extension.go
generated
vendored
88
vendor/google.golang.org/protobuf/proto/extension.go
generated
vendored
@ -11,18 +11,21 @@ import (
|
||||
// HasExtension reports whether an extension field is populated.
|
||||
// It returns false if m is invalid or if xt does not extend m.
|
||||
func HasExtension(m Message, xt protoreflect.ExtensionType) bool {
|
||||
// Treat nil message interface as an empty message; no populated fields.
|
||||
if m == nil {
|
||||
// Treat nil message interface or descriptor as an empty message; no populated
|
||||
// fields.
|
||||
if m == nil || xt == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// As a special-case, we reports invalid or mismatching descriptors
|
||||
// as always not being populated (since they aren't).
|
||||
if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() {
|
||||
mr := m.ProtoReflect()
|
||||
xd := xt.TypeDescriptor()
|
||||
if mr.Descriptor() != xd.ContainingMessage() {
|
||||
return false
|
||||
}
|
||||
|
||||
return m.ProtoReflect().Has(xt.TypeDescriptor())
|
||||
return mr.Has(xd)
|
||||
}
|
||||
|
||||
// ClearExtension clears an extension field such that subsequent
|
||||
@ -36,7 +39,49 @@ func ClearExtension(m Message, xt protoreflect.ExtensionType) {
|
||||
// If the field is unpopulated, it returns the default value for
|
||||
// scalars and an immutable, empty value for lists or messages.
|
||||
// It panics if xt does not extend m.
|
||||
func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
|
||||
//
|
||||
// The type of the value is dependent on the field type of the extension.
|
||||
// For extensions generated by protoc-gen-go, the Go type is as follows:
|
||||
//
|
||||
// ╔═══════════════════╤═════════════════════════╗
|
||||
// ║ Go type │ Protobuf kind ║
|
||||
// ╠═══════════════════╪═════════════════════════╣
|
||||
// ║ bool │ bool ║
|
||||
// ║ int32 │ int32, sint32, sfixed32 ║
|
||||
// ║ int64 │ int64, sint64, sfixed64 ║
|
||||
// ║ uint32 │ uint32, fixed32 ║
|
||||
// ║ uint64 │ uint64, fixed64 ║
|
||||
// ║ float32 │ float ║
|
||||
// ║ float64 │ double ║
|
||||
// ║ string │ string ║
|
||||
// ║ []byte │ bytes ║
|
||||
// ║ protoreflect.Enum │ enum ║
|
||||
// ║ proto.Message │ message, group ║
|
||||
// ╚═══════════════════╧═════════════════════════╝
|
||||
//
|
||||
// The protoreflect.Enum and proto.Message types are the concrete Go type
|
||||
// associated with the named enum or message. Repeated fields are represented
|
||||
// using a Go slice of the base element type.
|
||||
//
|
||||
// If a generated extension descriptor variable is directly passed to
|
||||
// GetExtension, then the call should be followed immediately by a
|
||||
// type assertion to the expected output value. For example:
|
||||
//
|
||||
// mm := proto.GetExtension(m, foopb.E_MyExtension).(*foopb.MyMessage)
|
||||
//
|
||||
// This pattern enables static analysis tools to verify that the asserted type
|
||||
// matches the Go type associated with the extension field and
|
||||
// also enables a possible future migration to a type-safe extension API.
|
||||
//
|
||||
// Since singular messages are the most common extension type, the pattern of
|
||||
// calling HasExtension followed by GetExtension may be simplified to:
|
||||
//
|
||||
// if mm := proto.GetExtension(m, foopb.E_MyExtension).(*foopb.MyMessage); mm != nil {
|
||||
// ... // make use of mm
|
||||
// }
|
||||
//
|
||||
// The mm variable is non-nil if and only if HasExtension reports true.
|
||||
func GetExtension(m Message, xt protoreflect.ExtensionType) any {
|
||||
// Treat nil message interface as an empty message; return the default.
|
||||
if m == nil {
|
||||
return xt.InterfaceOf(xt.Zero())
|
||||
@ -48,7 +93,36 @@ func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
|
||||
// SetExtension stores the value of an extension field.
|
||||
// It panics if m is invalid, xt does not extend m, or if type of v
|
||||
// is invalid for the specified extension field.
|
||||
func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
|
||||
//
|
||||
// The type of the value is dependent on the field type of the extension.
|
||||
// For extensions generated by protoc-gen-go, the Go type is as follows:
|
||||
//
|
||||
// ╔═══════════════════╤═════════════════════════╗
|
||||
// ║ Go type │ Protobuf kind ║
|
||||
// ╠═══════════════════╪═════════════════════════╣
|
||||
// ║ bool │ bool ║
|
||||
// ║ int32 │ int32, sint32, sfixed32 ║
|
||||
// ║ int64 │ int64, sint64, sfixed64 ║
|
||||
// ║ uint32 │ uint32, fixed32 ║
|
||||
// ║ uint64 │ uint64, fixed64 ║
|
||||
// ║ float32 │ float ║
|
||||
// ║ float64 │ double ║
|
||||
// ║ string │ string ║
|
||||
// ║ []byte │ bytes ║
|
||||
// ║ protoreflect.Enum │ enum ║
|
||||
// ║ proto.Message │ message, group ║
|
||||
// ╚═══════════════════╧═════════════════════════╝
|
||||
//
|
||||
// The protoreflect.Enum and proto.Message types are the concrete Go type
|
||||
// associated with the named enum or message. Repeated fields are represented
|
||||
// using a Go slice of the base element type.
|
||||
//
|
||||
// If a generated extension descriptor variable is directly passed to
|
||||
// SetExtension (e.g., foopb.E_MyExtension), then the value should be a
|
||||
// concrete type that matches the expected Go type for the extension descriptor
|
||||
// so that static analysis tools can verify type correctness.
|
||||
// This also enables a possible future migration to a type-safe extension API.
|
||||
func SetExtension(m Message, xt protoreflect.ExtensionType, v any) {
|
||||
xd := xt.TypeDescriptor()
|
||||
pv := xt.ValueOf(v)
|
||||
|
||||
@ -75,7 +149,7 @@ func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
|
||||
// It returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current extension field.
|
||||
func RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) {
|
||||
func RangeExtensions(m Message, f func(protoreflect.ExtensionType, any) bool) {
|
||||
// Treat nil message interface as an empty message; nothing to range over.
|
||||
if m == nil {
|
||||
return
|
||||
|
7
vendor/google.golang.org/protobuf/proto/messageset.go
generated
vendored
7
vendor/google.golang.org/protobuf/proto/messageset.go
generated
vendored
@ -47,11 +47,16 @@ func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]b
|
||||
func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
|
||||
b = messageset.AppendFieldStart(b, fd.Number())
|
||||
b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)
|
||||
b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))
|
||||
calculatedSize := o.Size(value.Message().Interface())
|
||||
b = protowire.AppendVarint(b, uint64(calculatedSize))
|
||||
before := len(b)
|
||||
b, err := o.marshalMessage(b, value.Message())
|
||||
if err != nil {
|
||||
return b, err
|
||||
}
|
||||
if measuredSize := len(b) - before; calculatedSize != measuredSize {
|
||||
return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
|
||||
}
|
||||
b = messageset.AppendFieldEnd(b)
|
||||
return b, nil
|
||||
}
|
||||
|
2
vendor/google.golang.org/protobuf/proto/size.go
generated
vendored
2
vendor/google.golang.org/protobuf/proto/size.go
generated
vendored
@ -34,6 +34,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) {
|
||||
if methods != nil && methods.Size != nil {
|
||||
out := methods.Size(protoiface.SizeInput{
|
||||
Message: m,
|
||||
Flags: o.flags(),
|
||||
})
|
||||
return out.Size
|
||||
}
|
||||
@ -42,6 +43,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) {
|
||||
// This case is mainly used for legacy types with a Marshal method.
|
||||
out, _ := methods.Marshal(protoiface.MarshalInput{
|
||||
Message: m,
|
||||
Flags: o.flags(),
|
||||
})
|
||||
return len(out.Buf)
|
||||
}
|
||||
|
Reference in New Issue
Block a user