aboutsummaryrefslogtreecommitdiff
path: root/header_test.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2019-12-14 22:20:09 +0100
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2019-12-14 22:20:09 +0100
commit415e5fc531692d7533e08d7addf33a26b0b8f99a (patch)
treeb19544ebaa79d6df81d14ebb53e43a1c967674b2 /header_test.go
parentImprove multiline header parsing (#708) (diff)
downloadfasthttp-415e5fc531692d7533e08d7addf33a26b0b8f99a.tar.gz
fasthttp-415e5fc531692d7533e08d7addf33a26b0b8f99a.tar.bz2
fasthttp-415e5fc531692d7533e08d7addf33a26b0b8f99a.zip
Fix panic in header parserv1.7.0
Diffstat (limited to 'header_test.go')
-rw-r--r--header_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/header_test.go b/header_test.go
index cec008f..7f84a63 100644
--- a/header_test.go
+++ b/header_test.go
@@ -3,6 +3,7 @@ package fasthttp
import (
"bufio"
"bytes"
+ "encoding/base64"
"fmt"
"io"
"io/ioutil"
@@ -55,6 +56,13 @@ func TestResponseHeaderMultiLineName(t *testing.T) {
}
}
+func TestResponseHeaderMultiLinePaniced(t *testing.T) {
+ // Input generated by fuzz testing that caused the parser to panic.
+ s, _ := base64.StdEncoding.DecodeString("aAEAIDoKKDoKICA6CgkKCiA6CiA6CgkpCiA6CiA6CiA6Cig6CiAgOgoJCgogOgogOgoJKQogOgogOgogOgogOgogOgoJOg86CiA6CiA6Cig6CiAyCg==")
+ header := new(RequestHeader)
+ header.parse(s) //nolint:errcheck
+}
+
func TestResponseHeaderEmptyValueFromHeader(t *testing.T) {
t.Parallel()