Skip to content

Commit 9ff8b37

Browse files
committed
fix bug: endPos is greater than the boundary
1 parent a22041f commit 9ff8b37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

primitive_decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func DecodePrimitivePacket(buf []byte) (packet *PrimitivePacket, endPos int, siz
5454

5555
logger.Debugf(">>> sizeL=%v, length=%v, pos=%v, endPos=%v", sizeL, p.length, pos, endPos)
5656

57-
if pos > endPos {
57+
if pos > endPos || endPos > len(buf) || pos > len(buf) {
5858
return nil, 0, sizeL, fmt.Errorf("beyond the boundary, pos=%v, endPos=%v", pos, endPos)
5959
}
6060
p.valBuf = buf[pos:endPos]

0 commit comments

Comments
 (0)