@@ -1297,6 +1297,9 @@ func (f *framer) readBytes() []byte {
func (f *framer) readShortBytes() []byte {
size := f.readShort()
+ if len(f.rbuf) < int(size) {
+ panic(fmt.Errorf("not enough bytes in buffer to read short bytes: require %d got %d", size, len(f.rbuf)))
+ }
l := make([]byte, size)
copy(l, f.rbuf[:size])
@@ -20,6 +20,7 @@ func TestFuzzBugs(t *testing.T) {
"\xff0000000000000000000" +
"0000000"),
[]byte("\x82\xe600\x00\x00\x00\x000"),
+ []byte("\x8200\b\x00\x00\x00\b0\x00\x00\x00\x040000"),
}
for i, test := range tests {