summaryrefslogtreecommitdiffhomepage
path: root/replacer_test.go
diff options
context:
space:
mode:
authorBill Glover <[email protected]>2020-03-11 22:12:00 +0000
committerGitHub <[email protected]>2020-03-11 16:12:00 -0600
commitcfe85a9fe625fea55dc4f809fd91b5c061064508 (patch)
treefe77310c343f15acb09552edc435b73c755483c4 /replacer_test.go
parent90f1f7bce75686d3a9864e1f36abf15930b3fc5f (diff)
downloadcaddy-cfe85a9fe625fea55dc4f809fd91b5c061064508.tar.gz
caddy-cfe85a9fe625fea55dc4f809fd91b5c061064508.zip
Fix #3130: Crash at fuzzing target replacer (#3133)
* Fix #3130: Crash at fuzzing target replacer * Add additional test case based on fuzzer feedback
Diffstat (limited to 'replacer_test.go')
-rw-r--r--replacer_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/replacer_test.go b/replacer_test.go
index 66bb53790..a48917ab5 100644
--- a/replacer_test.go
+++ b/replacer_test.go
@@ -156,6 +156,14 @@ func TestReplacer(t *testing.T) {
input: `\{'group':'default','max_age':3600,'endpoints':[\{'url':'https://some.domain.local/a/d/g'\}],'include_subdomains':true\}`,
expect: `{'group':'default','max_age':3600,'endpoints':[{'url':'https://some.domain.local/a/d/g'}],'include_subdomains':true}`,
},
+ {
+ input: `{}{}{}{\\\\}\\\\`,
+ expect: `{\\\}\\\\`,
+ },
+ {
+ input: string([]byte{0x26, 0x00, 0x83, 0x7B, 0x84, 0x07, 0x5C, 0x7D, 0x84}),
+ expect: string([]byte{0x26, 0x00, 0x83, 0x7B, 0x84, 0x07, 0x7D, 0x84}),
+ },
} {
actual := rep.ReplaceAll(tc.input, tc.empty)
if actual != tc.expect {