diff options
| author | Tim Graham <timograham@gmail.com> | 2018-02-24 16:22:43 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-06 08:30:40 -0500 |
| commit | 97b7dd59bb8d6163239061e2022153c3415d146d (patch) | |
| tree | 9226d827f280e10f46d7abba5a5228d2cfd87538 /tests/utils_tests/test_text.py | |
| parent | 8618271caa0b09daba39ff3b46567d33ae1e1d3a (diff) | |
Fixed CVE-2018-7537 -- Fixed catastrophic backtracking in django.utils.text.Truncator.
Thanks James Davis for suggesting the fix.
Diffstat (limited to 'tests/utils_tests/test_text.py')
| -rw-r--r-- | tests/utils_tests/test_text.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py index 89f9716bb5..693c436eb8 100644 --- a/tests/utils_tests/test_text.py +++ b/tests/utils_tests/test_text.py @@ -136,6 +136,10 @@ class TestUtilsText(SimpleTestCase): truncator = text.Truncator('<p>I <3 python, what about you?</p>') self.assertEqual('<p>I <3 python...</p>', truncator.words(3, '...', html=True)) + re_tag_catastrophic_test = ('</a' + '\t' * 50000) + '//>' + truncator = text.Truncator(re_tag_catastrophic_test) + self.assertEqual(re_tag_catastrophic_test, truncator.words(500, html=True)) + def test_wrap(self): digits = '1234 67 9' self.assertEqual(text.wrap(digits, 100), '1234 67 9') |
