mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed CVE-2018-7537 -- Fixed catastrophic backtracking in django.utils.text.Truncator.
Thanks James Davis for suggesting the fix.
This commit is contained in:
parent
8618271caa
commit
97b7dd59bb
5 changed files with 41 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue