A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/django/django/commit/a91436360b79a6ff995c3e5018bcc666dfaf1539 below:

[1.11.x] Fixed CVE-2018-7537 -- Fixed catastrophic backtracking in dj… · django/django@a914363 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+29

-1

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+29

-1

lines changed Original file line number Diff line number Diff line change

@@ -29,7 +29,7 @@ def capfirst(x):

29 29

# Set up regular expressions

30 30

re_words = re.compile(r'<.*?>|((?:\w[-\w]*|&.*?;)+)', re.U | re.S)

31 31

re_chars = re.compile(r'<.*?>|(.)', re.U | re.S)

32 -

re_tag = re.compile(r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>', re.S)

32 +

re_tag = re.compile(r'<(/)?(\S+?)(?:(\s*/)|\s.*?)?>', re.S)

33 33

re_newlines = re.compile(r'\r\n|\r') # Used in normalize_newlines

34 34

re_camel_case = re.compile(r'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))')

35 35 Original file line number Diff line number Diff line change

@@ -16,3 +16,15 @@ expressions. The ``urlize()`` function is used to implement the ``urlize`` and

16 16 17 17

The problematic regular expressions are replaced with parsing logic that

18 18

behaves similarly.

19 + 20 +

CVE-2018-7537: Denial-of-service possibility in ``truncatechars_html`` and ``truncatewords_html`` template filters

21 +

==================================================================================================================

22 + 23 +

If ``django.utils.text.Truncator``'s ``chars()`` and ``words()`` methods were

24 +

passed the ``html=True`` argument, they were extremely slow to evaluate certain

25 +

inputs due to a catastrophic backtracking vulnerability in a regular

26 +

expression. The ``chars()`` and ``words()`` methods are used to implement the

27 +

``truncatechars_html`` and ``truncatewords_html`` template filters, which were

28 +

thus vulnerable.

29 + 30 +

The backtracking problem in the regular expression is fixed.

Original file line number Diff line number Diff line change

@@ -16,3 +16,15 @@ expression. The ``urlize()`` function is used to implement the ``urlize`` and

16 16 17 17

The problematic regular expression is replaced with parsing logic that behaves

18 18

similarly.

19 + 20 +

CVE-2018-7537: Denial-of-service possibility in ``truncatechars_html`` and ``truncatewords_html`` template filters

21 +

==================================================================================================================

22 + 23 +

If ``django.utils.text.Truncator``'s ``chars()`` and ``words()`` methods were

24 +

passed the ``html=True`` argument, they were extremely slow to evaluate certain

25 +

inputs due to a catastrophic backtracking vulnerability in a regular

26 +

expression. The ``chars()`` and ``words()`` methods are used to implement the

27 +

``truncatechars_html`` and ``truncatewords_html`` template filters, which were

28 +

thus vulnerable.

29 + 30 +

The backtracking problem in the regular expression is fixed.

Original file line number Diff line number Diff line change

@@ -139,6 +139,10 @@ def test_truncate_html_words(self):

139 139

truncator = text.Truncator('<p>I &lt;3 python, what about you?</p>')

140 140

self.assertEqual('<p>I &lt;3 python...</p>', truncator.words(3, '...', html=True))

141 141 142 +

re_tag_catastrophic_test = ('</a' + '\t' * 50000) + '//>'

143 +

truncator = text.Truncator(re_tag_catastrophic_test)

144 +

self.assertEqual(re_tag_catastrophic_test, truncator.words(500, html=True))

145 + 142 146

def test_wrap(self):

143 147

digits = '1234 67 9'

144 148

self.assertEqual(text.wrap(digits, 100), '1234 67 9')

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4