mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-23 23:33:23 +00:00
Security fix - containerd to 1.7.27
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
33
vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
33
vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
@ -67,7 +67,6 @@ type lazyExtensionValue struct {
|
||||
xi *extensionFieldInfo
|
||||
value protoreflect.Value
|
||||
b []byte
|
||||
fn func() protoreflect.Value
|
||||
}
|
||||
|
||||
type ExtensionField struct {
|
||||
@ -99,6 +98,28 @@ func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// isUnexpandedLazy returns true if the ExensionField is lazy and not
|
||||
// yet expanded, which means it's present and already checked for
|
||||
// initialized required fields.
|
||||
func (f *ExtensionField) isUnexpandedLazy() bool {
|
||||
return f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0
|
||||
}
|
||||
|
||||
// lazyBuffer retrieves the buffer for a lazy extension if it's not yet expanded.
|
||||
//
|
||||
// The returned buffer has to be kept over whatever operation we're planning,
|
||||
// as re-retrieving it will fail after the message is lazily decoded.
|
||||
func (f *ExtensionField) lazyBuffer() []byte {
|
||||
// This function might be in the critical path, so check the atomic without
|
||||
// taking a look first, then only take the lock if needed.
|
||||
if !f.isUnexpandedLazy() {
|
||||
return nil
|
||||
}
|
||||
f.lazy.mu.Lock()
|
||||
defer f.lazy.mu.Unlock()
|
||||
return f.lazy.b
|
||||
}
|
||||
|
||||
func (f *ExtensionField) lazyInit() {
|
||||
f.lazy.mu.Lock()
|
||||
defer f.lazy.mu.Unlock()
|
||||
@ -136,10 +157,9 @@ func (f *ExtensionField) lazyInit() {
|
||||
}
|
||||
f.lazy.value = val
|
||||
} else {
|
||||
f.lazy.value = f.lazy.fn()
|
||||
panic("No support for lazy fns for ExtensionField")
|
||||
}
|
||||
f.lazy.xi = nil
|
||||
f.lazy.fn = nil
|
||||
f.lazy.b = nil
|
||||
atomic.StoreUint32(&f.lazy.atomicOnce, 1)
|
||||
}
|
||||
@ -152,13 +172,6 @@ func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value)
|
||||
f.lazy = nil
|
||||
}
|
||||
|
||||
// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
|
||||
// This must not be called concurrently.
|
||||
func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) {
|
||||
f.typ = t
|
||||
f.lazy = &lazyExtensionValue{fn: fn}
|
||||
}
|
||||
|
||||
// Value returns the value of the extension field.
|
||||
// This may be called concurrently.
|
||||
func (f *ExtensionField) Value() protoreflect.Value {
|
||||
|
Reference in New Issue
Block a user