validate lengths when parsing frames

ref #123
This commit is contained in:
Lucas Clemente
2016-05-27 23:07:29 +02:00
parent c546f5c9dc
commit 7c23ba7b07
4 changed files with 20 additions and 0 deletions

View File

@@ -47,6 +47,12 @@ var _ = Describe("StreamFrame", func() {
_, err := ParseStreamFrame(b)
Expect(err).To(MatchError(qerr.EmptyStreamFrameNoFin))
})
It("rejects frames to too large dataLen", func() {
b := bytes.NewReader([]byte{0xa0, 0x1, 0xff, 0xf})
_, err := ParseStreamFrame(b)
Expect(err).To(MatchError(qerr.Error(qerr.InvalidStreamData, "data len too large")))
})
})
Context("when writing", func() {