Check that chunk buffer length fits in 16 bit.
Change-Id: Id086a54aa8a1990c1979e747c1c02e53bed6d447
This commit is contained in:
parent
1ca7f24137
commit
fd01d07589
|
@ -326,7 +326,9 @@ func (c *deltaEncodedChunk) lastTime() clientmodel.Timestamp {
|
|||
}
|
||||
|
||||
func (c *deltaEncodedChunk) marshal(w io.Writer) error {
|
||||
// TODO: check somewhere that configured buf len cannot overflow 16 bit.
|
||||
if len(c.buf) > math.MaxUint16 {
|
||||
panic("chunk buffer length would overflow a 16 bit uint.")
|
||||
}
|
||||
binary.LittleEndian.PutUint16(c.buf[deltaHeaderBufLenOffset:], uint16(len(c.buf)))
|
||||
|
||||
n, err := w.Write(c.buf[:cap(c.buf)])
|
||||
|
|
Loading…
Reference in New Issue