diff options
author | 2022-05-02 14:05:18 +0100 | |
---|---|---|
committer | 2022-05-02 15:05:18 +0200 | |
commit | b56dae8120d43b9acd3d3ed4d40100ffab7b972a (patch) | |
tree | d55d30589d8a8499ed3d5eecba163abc9fa78c27 /vendor/github.com/ugorji/go | |
parent | add extra indexes as a migration (#527) (diff) | |
download | gotosocial-b56dae8120d43b9acd3d3ed4d40100ffab7b972a.tar.xz |
[chore] Update all but bun libraries (#526)
* update all but bun libraries
Signed-off-by: kim <grufwub@gmail.com>
* remove my personal build script changes
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/ugorji/go')
-rw-r--r-- | vendor/github.com/ugorji/go/codec/binc.go | 3 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/cbor.go | 3 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/decimal.go | 8 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl | 2 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/gen.generated.go | 2 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/helper.go | 43 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/helper_unsafe.go | 1 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/msgpack.go | 3 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/reader.go | 6 | ||||
-rw-r--r-- | vendor/github.com/ugorji/go/codec/simple.go | 3 |
10 files changed, 56 insertions, 18 deletions
diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go index 93d85cb4a..e54215dd4 100644 --- a/vendor/github.com/ugorji/go/codec/binc.go +++ b/vendor/github.com/ugorji/go/codec/binc.go @@ -811,6 +811,9 @@ func (d *bincDecDriver) DecodeBytes(bs []byte) (bsOut []byte) { for i := 0; i < slen; i++ { bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8)) } + for i := len(bs); i < slen; i++ { + bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8))) + } return bs } var clen int diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go index 0be358ec4..45eb822b9 100644 --- a/vendor/github.com/ugorji/go/codec/cbor.go +++ b/vendor/github.com/ugorji/go/codec/cbor.go @@ -610,6 +610,9 @@ func (d *cborDecDriver) DecodeBytes(bs []byte) (bsOut []byte) { for i := 0; i < len(bs); i++ { bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8)) } + for i := len(bs); i < slen; i++ { + bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8))) + } return bs } clen := d.decLen() diff --git a/vendor/github.com/ugorji/go/codec/decimal.go b/vendor/github.com/ugorji/go/codec/decimal.go index 6b617f5a9..dbb338049 100644 --- a/vendor/github.com/ugorji/go/codec/decimal.go +++ b/vendor/github.com/ugorji/go/codec/decimal.go @@ -132,12 +132,20 @@ var fi64 = floatinfo{52, 22, 15, false, 1<<52 - 1} var fi64u = floatinfo{0, 19, 0, true, fUint64Cutoff} func noFrac64(fbits uint64) bool { + if fbits == 0 { + return true + } + exp := uint64(fbits>>52)&0x7FF - 1023 // uint(x>>shift)&mask - bias // clear top 12+e bits, the integer part; if the rest is 0, then no fraction. return exp < 52 && fbits<<(12+exp) == 0 // means there's no fractional part } func noFrac32(fbits uint32) bool { + if fbits == 0 { + return true + } + exp := uint32(fbits>>23)&0xFF - 127 // uint(x>>shift)&mask - bias // clear top 9+e bits, the integer part; if the rest is 0, then no fraction. return exp < 23 && fbits<<(9+exp) == 0 // means there's no fractional part diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl index d2caa0b66..e92175059 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl @@ -78,7 +78,7 @@ if {{var "l"}} == 0 { {{var "v"}} = {{var "v"}}[:{{var "j"}}] {{var "c"}} = true } else if {{var "j"}} == 0 && {{var "v"}} == nil { - {{var "v"}} = make([]{{ .Typ }}, 0) + {{var "v"}} = []{{ .Typ }}{} {{var "c"}} = true } {{end -}} diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go index e72d00305..0ea79e75d 100644 --- a/vendor/github.com/ugorji/go/codec/gen.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen.generated.go @@ -149,7 +149,7 @@ if {{var "l"}} == 0 { {{var "v"}} = {{var "v"}}[:{{var "j"}}] {{var "c"}} = true } else if {{var "j"}} == 0 && {{var "v"}} == nil { - {{var "v"}} = make([]{{ .Typ }}, 0) + {{var "v"}} = []{{ .Typ }}{} {{var "c"}} = true } {{end -}} diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go index 68025c5d8..dc485a5ef 100644 --- a/vendor/github.com/ugorji/go/codec/helper.go +++ b/vendor/github.com/ugorji/go/codec/helper.go @@ -943,13 +943,18 @@ func (x *basicHandleRuntimeState) setExt(rt reflect.Type, tag uint64, ext Ext) ( } rtid := rt2id(rt) + // handle all natively supported type appropriately, so they cannot have an extension. + // However, we do not return an error for these, as we do not document that. + // Instead, we silently treat as a no-op, and return. switch rtid { - case timeTypId, rawTypId, rawExtTypId: - // these are all natively supported type, so they cannot have an extension. - // However, we do not return an error for these, as we do not document that. - // Instead, we silently treat as a no-op, and return. + case rawTypId, rawExtTypId: return + case timeTypId: + if x.timeBuiltin { + return + } } + for i := range x.extHandle { v := &x.extHandle[i] if v.rtid == rtid { @@ -1966,7 +1971,7 @@ func (ti *typeInfo) init(x []structFieldInfo, n int) { // Handling flagCanTransient // // We support transient optimization if the kind of the type is -// a number, bool, string, or slice. +// a number, bool, string, or slice (of number/bool). // In addition, we also support if the kind is struct or array, // and the type does not contain any pointers recursively). // @@ -1976,15 +1981,20 @@ func (ti *typeInfo) init(x []structFieldInfo, n int) { // when GC tries to follow a "transient" pointer which may become a non-pointer soon after. // -func isCanTransient(t reflect.Type, k reflect.Kind) (v bool) { - var bs *bitset32 +func transientBitsetFlags() *bitset32 { if transientValueHasStringSlice { - bs = &numBoolStrSliceBitset - } else { - bs = &numBoolBitset + return &numBoolStrSliceBitset } + return &numBoolBitset +} + +func isCanTransient(t reflect.Type, k reflect.Kind) (v bool) { + var bs = transientBitsetFlags() if bs.isset(byte(k)) { v = true + } else if k == reflect.Slice { + elem := t.Elem() + v = numBoolBitset.isset(byte(elem.Kind())) } else if k == reflect.Array { elem := t.Elem() v = isCanTransient(elem, elem.Kind()) @@ -2010,8 +2020,7 @@ func (ti *typeInfo) doSetFlagCanTransient() { ti.flagCanTransient = true } if ti.flagCanTransient { - // if ti kind is a num, bool, string or slice, then it is flagCanTransient - if !numBoolStrSliceBitset.isset(ti.kind) { + if !transientBitsetFlags().isset(ti.kind) { ti.flagCanTransient = isCanTransient(ti.rt, reflect.Kind(ti.kind)) } } @@ -2472,13 +2481,19 @@ func panicValToErr(h errDecorator, v interface{}, err *error) { } func usableByteSlice(bs []byte, slen int) (out []byte, changed bool) { + const maxCap = 1024 * 1024 * 64 // 64MB + const skipMaxCap = false // allow to test if slen <= 0 { return []byte{}, true } - if cap(bs) < slen { + if slen <= cap(bs) { + return bs[:slen], false + } + // slen > cap(bs) ... handle memory overload appropriately + if skipMaxCap || slen <= maxCap { return make([]byte, slen), true } - return bs[:slen], false + return make([]byte, maxCap), true } func mapKeyFastKindFor(k reflect.Kind) mapKeyFastKind { diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go index 352cf4b3c..34cda6e27 100644 --- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_unsafe.go @@ -376,6 +376,7 @@ func i2rtid(i interface{}) uintptr { // -------------------------- func unsafeCmpZero(ptr unsafe.Pointer, size int) bool { + // verified that size is always within right range, so no chance of OOM var s1 = unsafeString{ptr, size} var s2 = unsafeString{unsafeZeroAddr, size} if size > len(unsafeZeroArr) { diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go index df78885a9..dc25530e7 100644 --- a/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/vendor/github.com/ugorji/go/codec/msgpack.go @@ -851,6 +851,9 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte) (bsOut []byte) { for i := 0; i < len(bs); i++ { bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8)) } + for i := len(bs); i < slen; i++ { + bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8))) + } return bs } else { d.d.errorf("invalid byte descriptor for decoding bytes, got: 0x%x", d.bd) diff --git a/vendor/github.com/ugorji/go/codec/reader.go b/vendor/github.com/ugorji/go/codec/reader.go index 802938c7d..a683d9a2a 100644 --- a/vendor/github.com/ugorji/go/codec/reader.go +++ b/vendor/github.com/ugorji/go/codec/reader.go @@ -8,9 +8,11 @@ import "io" // decReader abstracts the reading source, allowing implementations that can // read from an io.Reader or directly off a byte slice with zero-copying. type decReader interface { - // readx will use the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR - // just return a view of the []byte being decoded from. + // readx will return a view of the []byte if decoding from a []byte, OR + // read into the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR + // create a new []byte and read into that readx(n uint) []byte + readb([]byte) readn1() byte diff --git a/vendor/github.com/ugorji/go/codec/simple.go b/vendor/github.com/ugorji/go/codec/simple.go index c3c09f1cf..e8a63717e 100644 --- a/vendor/github.com/ugorji/go/codec/simple.go +++ b/vendor/github.com/ugorji/go/codec/simple.go @@ -449,6 +449,9 @@ func (d *simpleDecDriver) DecodeBytes(bs []byte) (bsOut []byte) { for i := 0; i < len(bs); i++ { bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8)) } + for i := len(bs); i < slen; i++ { + bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8))) + } return bs } |