diff --git a/tests/test_multipart.py b/tests/test_multipart.py index 031515b..2ceecab 100644 --- a/tests/test_multipart.py +++ b/tests/test_multipart.py @@ -270,6 +270,11 @@ def test_handles_ie6_bug(self): t, p = parse_options_header(b'text/plain; filename="C:\\this\\is\\a\\path\\file.txt"') self.assertEqual(p[b'filename'], b'file.txt') + + def test_redos_attack_header(self): + t, p = parse_options_header(b'application/x-www-form-urlencoded; !="\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') + # If vulnerable, this test wouldn't finish, the line above would hang + self.assertIn(b'"\\', p[b'!']) class TestBaseParser(unittest.TestCase):