diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2022-03-01 20:50:12 +0100 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2022-03-01 20:50:12 +0100 |
commit | 1116d034d5354b2975a6089aad66dea00da696f3 (patch) | |
tree | 3c87001096c896226ccac6664163653261fe1aad /http_test.go | |
parent | Update dependencies (#1230) (diff) | |
download | fasthttp-1116d034d5354b2975a6089aad66dea00da696f3.tar.gz fasthttp-1116d034d5354b2975a6089aad66dea00da696f3.tar.bz2 fasthttp-1116d034d5354b2975a6089aad66dea00da696f3.zip |
Fix panic while reading invalid trailers
Diffstat (limited to 'http_test.go')
-rw-r--r-- | http_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/http_test.go b/http_test.go index 426b70a..12ca1f1 100644 --- a/http_test.go +++ b/http_test.go @@ -32,6 +32,9 @@ func TestInvalidTrailers(t *testing.T) { if err := (&Response{}).Read(bufio.NewReader(bytes.NewReader([]byte{0x54, 0x52, 0x61, 0x49, 0x4c, 0x65, 0x52, 0x3a, 0x2c, 0x0a, 0x0a}))); !strings.Contains(err.Error(), "cannot find whitespace in the first line of response") { t.Fatal(err) } + if err := (&Request{}).Read(bufio.NewReader(bytes.NewReader([]byte{0xff, 0x20, 0x0a, 0x54, 0x52, 0x61, 0x49, 0x4c, 0x65, 0x52, 0x3a, 0x2c, 0x0a, 0x0a}))); !strings.Contains(err.Error(), "contain forbidden trailer") { + t.Fatal(err) + } b, _ := base64.StdEncoding.DecodeString("tCAKIDoKCToKICAKCToKICAKCToKIAogOgoJOgogIAoJOgovIC8vOi4KOh0KVFJhSUxlUjo9HT09HQpUUmFJTGVSOicQAApUUmFJTGVSOj0gHSAKCT09HQoKOgoKCgo=") if err := (&Request{}).Read(bufio.NewReader(bytes.NewReader(b))); !strings.Contains(err.Error(), "error when reading request headers: invalid header key") { |