build(deps): bump github.com/nats-io/nats-server/v2
Bumps [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) from 2.10.9 to 2.10.10. - [Release notes](https://github.com/nats-io/nats-server/releases) - [Changelog](https://github.com/nats-io/nats-server/blob/main/.goreleaser.yml) - [Commits](https://github.com/nats-io/nats-server/compare/v2.10.9...v2.10.10) --- updated-dependencies: - dependency-name: github.com/nats-io/nats-server/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
dcc17b3994
commit
892660433f
+6
@@ -10,6 +10,8 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/klauspost/compress/internal/race"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -63,6 +65,10 @@ func Decode(dst, src []byte) ([]byte, error) {
|
||||
} else {
|
||||
dst = make([]byte, dLen)
|
||||
}
|
||||
|
||||
race.WriteSlice(dst)
|
||||
race.ReadSlice(src[s:])
|
||||
|
||||
if s2Decode(dst, src[s:]) != 0 {
|
||||
return nil, ErrCorrupt
|
||||
}
|
||||
|
||||
+14
@@ -3,6 +3,8 @@
|
||||
|
||||
package s2
|
||||
|
||||
import "github.com/klauspost/compress/internal/race"
|
||||
|
||||
const hasAmd64Asm = true
|
||||
|
||||
// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It
|
||||
@@ -14,6 +16,9 @@ const hasAmd64Asm = true
|
||||
// len(dst) >= MaxEncodedLen(len(src)) &&
|
||||
// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
|
||||
func encodeBlock(dst, src []byte) (d int) {
|
||||
race.ReadSlice(src)
|
||||
race.WriteSlice(dst)
|
||||
|
||||
const (
|
||||
// Use 12 bit table when less than...
|
||||
limit12B = 16 << 10
|
||||
@@ -50,6 +55,9 @@ func encodeBlock(dst, src []byte) (d int) {
|
||||
// len(dst) >= MaxEncodedLen(len(src)) &&
|
||||
// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
|
||||
func encodeBlockBetter(dst, src []byte) (d int) {
|
||||
race.ReadSlice(src)
|
||||
race.WriteSlice(dst)
|
||||
|
||||
const (
|
||||
// Use 12 bit table when less than...
|
||||
limit12B = 16 << 10
|
||||
@@ -86,6 +94,9 @@ func encodeBlockBetter(dst, src []byte) (d int) {
|
||||
// len(dst) >= MaxEncodedLen(len(src)) &&
|
||||
// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
|
||||
func encodeBlockSnappy(dst, src []byte) (d int) {
|
||||
race.ReadSlice(src)
|
||||
race.WriteSlice(dst)
|
||||
|
||||
const (
|
||||
// Use 12 bit table when less than...
|
||||
limit12B = 16 << 10
|
||||
@@ -121,6 +132,9 @@ func encodeBlockSnappy(dst, src []byte) (d int) {
|
||||
// len(dst) >= MaxEncodedLen(len(src)) &&
|
||||
// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize
|
||||
func encodeBlockBetterSnappy(dst, src []byte) (d int) {
|
||||
race.ReadSlice(src)
|
||||
race.WriteSlice(dst)
|
||||
|
||||
const (
|
||||
// Use 12 bit table when less than...
|
||||
limit12B = 16 << 10
|
||||
|
||||
+10
-6
@@ -104,12 +104,14 @@ func ReaderIgnoreStreamIdentifier() ReaderOption {
|
||||
// For each chunk with the ID, the callback is called with the content.
|
||||
// Any returned non-nil error will abort decompression.
|
||||
// Only one callback per ID is supported, latest sent will be used.
|
||||
// You can peek the stream, triggering the callback, by doing a Read with a 0
|
||||
// byte buffer.
|
||||
func ReaderSkippableCB(id uint8, fn func(r io.Reader) error) ReaderOption {
|
||||
return func(r *Reader) error {
|
||||
if id < 0x80 || id > 0xfd {
|
||||
return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfd (inclusive)")
|
||||
}
|
||||
r.skippableCB[id] = fn
|
||||
r.skippableCB[id-0x80] = fn
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -128,7 +130,7 @@ type Reader struct {
|
||||
err error
|
||||
decoded []byte
|
||||
buf []byte
|
||||
skippableCB [0x80]func(r io.Reader) error
|
||||
skippableCB [0xff - 0x80]func(r io.Reader) error
|
||||
blockStart int64 // Uncompressed offset at start of current.
|
||||
index *Index
|
||||
|
||||
@@ -201,7 +203,7 @@ func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) {
|
||||
// The supplied slice does not need to be the size of the read.
|
||||
func (r *Reader) skippable(tmp []byte, n int, allowEOF bool, id uint8) (ok bool) {
|
||||
if id < 0x80 {
|
||||
r.err = fmt.Errorf("interbal error: skippable id < 0x80")
|
||||
r.err = fmt.Errorf("internal error: skippable id < 0x80")
|
||||
return false
|
||||
}
|
||||
if fn := r.skippableCB[id-0x80]; fn != nil {
|
||||
@@ -1048,15 +1050,17 @@ func (r *Reader) ReadByte() (byte, error) {
|
||||
}
|
||||
|
||||
// SkippableCB will register a callback for chunks with the specified ID.
|
||||
// ID must be a Reserved skippable chunks ID, 0x80-0xfe (inclusive).
|
||||
// ID must be a Reserved skippable chunks ID, 0x80-0xfd (inclusive).
|
||||
// For each chunk with the ID, the callback is called with the content.
|
||||
// Any returned non-nil error will abort decompression.
|
||||
// Only one callback per ID is supported, latest sent will be used.
|
||||
// Sending a nil function will disable previous callbacks.
|
||||
// You can peek the stream, triggering the callback, by doing a Read with a 0
|
||||
// byte buffer.
|
||||
func (r *Reader) SkippableCB(id uint8, fn func(r io.Reader) error) error {
|
||||
if id < 0x80 || id > chunkTypePadding {
|
||||
if id < 0x80 || id >= chunkTypePadding {
|
||||
return fmt.Errorf("ReaderSkippableCB: Invalid id provided, must be 0x80-0xfe (inclusive)")
|
||||
}
|
||||
r.skippableCB[id] = fn
|
||||
r.skippableCB[id-0x80] = fn
|
||||
return nil
|
||||
}
|
||||
|
||||
+4
@@ -37,6 +37,8 @@ package s2
|
||||
import (
|
||||
"bytes"
|
||||
"hash/crc32"
|
||||
|
||||
"github.com/klauspost/compress/internal/race"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -112,6 +114,8 @@ var crcTable = crc32.MakeTable(crc32.Castagnoli)
|
||||
// crc implements the checksum specified in section 3 of
|
||||
// https://github.com/google/snappy/blob/master/framing_format.txt
|
||||
func crc(b []byte) uint32 {
|
||||
race.ReadSlice(b)
|
||||
|
||||
c := crc32.Update(0, crcTable, b)
|
||||
return c>>15 | c<<17 + 0xa282ead8
|
||||
}
|
||||
|
||||
+9
-5
@@ -13,6 +13,8 @@ import (
|
||||
"io"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"github.com/klauspost/compress/internal/race"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -271,7 +273,7 @@ func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) {
|
||||
return fmt.Errorf("skippable block excessed maximum size")
|
||||
}
|
||||
var header [4]byte
|
||||
chunkLen := 4 + len(data)
|
||||
chunkLen := len(data)
|
||||
header[0] = id
|
||||
header[1] = uint8(chunkLen >> 0)
|
||||
header[2] = uint8(chunkLen >> 8)
|
||||
@@ -282,7 +284,7 @@ func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) {
|
||||
if err = w.err(err); err != nil {
|
||||
return err
|
||||
}
|
||||
if n != len(data) {
|
||||
if n != len(b) {
|
||||
return w.err(io.ErrShortWrite)
|
||||
}
|
||||
w.written += int64(n)
|
||||
@@ -303,9 +305,7 @@ func (w *Writer) AddSkippableBlock(id uint8, data []byte) (err error) {
|
||||
if err := write(header[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := write(data); err != nil {
|
||||
return err
|
||||
}
|
||||
return write(data)
|
||||
}
|
||||
|
||||
// Create output...
|
||||
@@ -385,6 +385,8 @@ func (w *Writer) EncodeBuffer(buf []byte) (err error) {
|
||||
buf = buf[len(uncompressed):]
|
||||
// Get an output buffer.
|
||||
obuf := w.buffers.Get().([]byte)[:len(uncompressed)+obufHeaderLen]
|
||||
race.WriteSlice(obuf)
|
||||
|
||||
output := make(chan result)
|
||||
// Queue output now, so we keep order.
|
||||
w.output <- output
|
||||
@@ -393,6 +395,8 @@ func (w *Writer) EncodeBuffer(buf []byte) (err error) {
|
||||
}
|
||||
w.uncompWritten += int64(len(uncompressed))
|
||||
go func() {
|
||||
race.ReadSlice(uncompressed)
|
||||
|
||||
checksum := crc(uncompressed)
|
||||
|
||||
// Set to uncompressed.
|
||||
|
||||
Reference in New Issue
Block a user