fix(deps): update github.com/godbus/dbus/v5 digest to 7623695

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2023-06-01 03:15:04 +00:00 committed by GitHub
parent 249f0463eb
commit 22424eb5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 91 additions and 9 deletions

2
go.mod
View File

@ -30,7 +30,7 @@ require (
github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651
github.com/docker/go-units v0.5.0
github.com/fsnotify/fsnotify v1.6.0
github.com/godbus/dbus/v5 v5.1.1-0.20230502183206-6cc540df4ec5
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466
github.com/google/gofuzz v1.2.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/google/uuid v1.3.0

4
go.sum
View File

@ -472,8 +472,8 @@ github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.1-0.20230502183206-6cc540df4ec5 h1:Nf+zAZaroBWc9zLetbUKzWGLu1xgSa5fTjvtqOLr4ds=
github.com/godbus/dbus/v5 v5.1.1-0.20230502183206-6cc540df4ec5/go.mod h1:fXoNnqaUvdKqjJmMGeiBgmRphUg+kO0MT4AhPOP6+Qg=
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 h1:sQspH8M4niEijh3PFscJRLDnkL547IeP7kpPe3uUhEg=
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466/go.mod h1:ZiQxhyQ+bbbfxUKVvjfO498oPYvtYhZzycal3G/NHmU=
github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU=
github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=

13
vendor/github.com/godbus/dbus/v5/SECURITY.md generated vendored Normal file
View File

@ -0,0 +1,13 @@
# Security Policy
## Supported Versions
Security updates are applied only to the latest release.
## Reporting a Vulnerability
If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
Please disclose it at [security advisory](https://github.com/godbus/dbus/security/advisories/new).
This project is maintained by a team of volunteers on a reasonable-effort basis. As such, vulnerabilities will be disclosed in a best effort base.

View File

@ -4,6 +4,7 @@ import (
"encoding/binary"
"io"
"reflect"
"unsafe"
)
type decoder struct {
@ -13,9 +14,10 @@ type decoder struct {
fds []int
// The following fields are used to reduce memory allocs.
buf []byte
d float64
y [1]byte
conv *stringConverter
buf []byte
d float64
y [1]byte
}
// newDecoder returns a new decoder that reads values from in. The input is
@ -25,6 +27,7 @@ func newDecoder(in io.Reader, order binary.ByteOrder, fds []int) *decoder {
dec.in = in
dec.order = order
dec.fds = fds
dec.conv = newStringConverter(stringConverterBufferSize)
return dec
}
@ -34,6 +37,10 @@ func (dec *decoder) Reset(in io.Reader, order binary.ByteOrder, fds []int) {
dec.order = order
dec.pos = 0
dec.fds = fds
if dec.conv == nil {
dec.conv = newStringConverter(stringConverterBufferSize)
}
}
// align aligns the input to the given boundary and panics on error.
@ -148,7 +155,7 @@ func (dec *decoder) decode(s string, depth int) interface{} {
p := int(length) + 1
dec.read2buf(p)
dec.pos += p
return string(dec.buf[:len(dec.buf)-1])
return dec.conv.String(dec.buf[:len(dec.buf)-1])
case 'o':
return ObjectPath(dec.decode("s", depth).(string))
case 'g':
@ -157,7 +164,7 @@ func (dec *decoder) decode(s string, depth int) interface{} {
dec.read2buf(p)
dec.pos += p
sig, err := ParseSignature(
string(dec.buf[:len(dec.buf)-1]),
dec.conv.String(dec.buf[:len(dec.buf)-1]),
)
if err != nil {
panic(err)
@ -310,3 +317,65 @@ type FormatError string
func (e FormatError) Error() string {
return "dbus: wire format error: " + string(e)
}
// stringConverterBufferSize defines the recommended buffer size of 4KB.
// It showed good results in a benchmark when decoding 35KB message,
// see https://github.com/marselester/systemd#testing.
const stringConverterBufferSize = 4096
func newStringConverter(capacity int) *stringConverter {
return &stringConverter{
buf: make([]byte, 0, capacity),
offset: 0,
}
}
// stringConverter converts bytes to strings with less allocs.
// The idea is to accumulate bytes in a buffer with specified capacity
// and create strings with unsafe package using bytes from a buffer.
// For example, 10 "fizz" strings written to a 40-byte buffer
// will result in 1 alloc instead of 10.
//
// Once a buffer is filled, a new one is created with the same capacity.
// Old buffers will be eventually GC-ed
// with no side effects to the returned strings.
type stringConverter struct {
// buf is a temporary buffer where decoded strings are batched.
buf []byte
// offset is a buffer position where the last string was written.
offset int
}
// String converts bytes to a string.
func (c *stringConverter) String(b []byte) string {
n := len(b)
if n == 0 {
return ""
}
// Must allocate because a string doesn't fit into the buffer.
if n > cap(c.buf) {
return string(b)
}
if len(c.buf)+n > cap(c.buf) {
c.buf = make([]byte, 0, cap(c.buf))
c.offset = 0
}
c.buf = append(c.buf, b...)
b = c.buf[c.offset:]
s := toString(b)
c.offset += n
return s
}
// toString converts a byte slice to a string without allocating.
// Starting from Go 1.20 you should use unsafe.String.
func toString(b []byte) string {
var s string
h := (*reflect.StringHeader)(unsafe.Pointer(&s))
h.Data = uintptr(unsafe.Pointer(&b[0]))
h.Len = len(b)
return s
}

2
vendor/modules.txt vendored
View File

@ -510,7 +510,7 @@ github.com/go-openapi/validate
# github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
## explicit; go 1.13
github.com/go-task/slim-sprig
# github.com/godbus/dbus/v5 v5.1.1-0.20230502183206-6cc540df4ec5
# github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466
## explicit; go 1.12
github.com/godbus/dbus/v5
# github.com/gogo/protobuf v1.3.2