Skip to content

Commit

Permalink
Add test with catastrophic backtracking
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalresistor committed Feb 1, 2019
1 parent 154beae commit 037d7d0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions colander/tests/test_colander.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,20 @@ def test_it_failure(self):

self.assertRaises(Invalid, self._callFUT, val)

def test_add_sample_dos(self):
# In the old regex this would cause a catastrophic backtracking that
# would cause the regex engine to go into an infinite loop.
val = "http://www.mysite.com/(tttttttttttttttttttttt.jpg"

result = self._callFUT(val)
self.assertEqual(result, None)

def test_website_no_scheme(self):
val = "www.mysite.com"

result = self._callFUT(val)
self.assertEqual(result, None)


class TestUUID(unittest.TestCase):
def _callFUT(self, val):
Expand Down

0 comments on commit 037d7d0

Please sign in to comment.