Open CGongsz opened 2 months ago
macos
go 1.22.1
all version
protobuf/grpc_compress.go
returned normally
panic index out of range [-1]
1、Define the empty reponse message XXXRes { } 2、Write an arbitrary compressor and register it (encoding.RegisterCompressor(compressor)) 3、Triggering the request 4、When the request returns,have a panic,'index out of range [-1]'
message XXXRes { }
mcache.Free
func Free(buf []byte) { size := cap(buf) if !isPowerOfTwo(size) { return } buf = buf[:0] caches[bsr(size)].Put(buf) } when size = 0,bsr(size) return -1
caches[-1] = nil
The fields in the response body are all default values, 'buf' will always be an empty slice
Operating System
macos
Go Version
go 1.22.1
Package Version
all version
Affected Packages
protobuf/grpc_compress.go
Expected Behavior
returned normally
Actual Behavior
panic index out of range [-1]
Reproduction Steps
1、Define the empty reponse
message XXXRes { }
2、Write an arbitrary compressor and register it (encoding.RegisterCompressor(compressor)) 3、Triggering the request 4、When the request returns,have a panic,'index out of range [-1]'Other Information
mcache.Free
func Free(buf []byte) { size := cap(buf) if !isPowerOfTwo(size) { return } buf = buf[:0] caches[bsr(size)].Put(buf) } when size = 0,bsr(size) return -1
caches[-1] = nil