From 8216801728ea2af82614025ca309a3b5db2ad982 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 3 Mar 2013 15:14:49 +1300 Subject: Three more errors turned up with fuzzing. These are fixed in netlib, regression tests added here. --- test/fuzzing/go_proxy | 4 ++-- test/test_fuzzing.py | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/fuzzing/go_proxy b/test/fuzzing/go_proxy index 1e6bbaef..5960d081 100755 --- a/test/fuzzing/go_proxy +++ b/test/fuzzing/go_proxy @@ -3,7 +3,7 @@ # mitmproxy/mitmdump is running on port 8080 in straight proxy mode. # pathod is running on port 9999 -BASE="/Users/aldo/git/public/pathod/venv/bin/pathoc -eo -I 200,400,502 -p 8080 localhost " -$BASE -n 1000 "get:'http://localhost:9999':ir,@1" +BASE="/Users/aldo/git/public/pathod/venv/bin/pathoc -eo -I 200,400,405,502 -p 8080 localhost " +$BASE -n 10000 "get:'http://localhost:9999':ir,@1" diff --git a/test/test_fuzzing.py b/test/test_fuzzing.py index 4b4253d8..857a2b10 100644 --- a/test/test_fuzzing.py +++ b/test/test_fuzzing.py @@ -1,7 +1,8 @@ import tservers """ - A collection of errors turned up by fuzzing. + A collection of errors turned up by fuzzing. Errors are integrated here + after being fixed to check for regressions. """ class TestFuzzy(tservers.HTTPProxTest): @@ -10,3 +11,17 @@ class TestFuzzy(tservers.HTTPProxTest): p = self.pathoc() assert p.request(req%self.server.port).status_code == 400 + def test_nullbytes(self): + req = r'get:"http://localhost:%s":i19,"\x00"' + p = self.pathoc() + assert p.request(req%self.server.port).status_code == 400 + + def test_invalid_ports(self): + req = 'get:"http://localhost:999999"' + p = self.pathoc() + assert p.request(req).status_code == 400 + + def test_invalid_ipv6_url(self): + req = 'get:"http://localhost:%s":i13,"["' + p = self.pathoc() + assert p.request(req%self.server.port).status_code == 400 -- cgit v1.2.3