1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[5.0.x] Fixed CVE-2025-26699 -- Mitigated potential DoS in wordwrap template filter.

Thanks sw0rd1ight for the report.

Backport of 55d89e25f4 from main.
This commit is contained in:
Sarah Boyce
2025-02-25 09:40:54 +01:00
parent e8d4030146
commit 4f27652323
4 changed files with 33 additions and 18 deletions

View File

@@ -78,3 +78,14 @@ class FunctionTests(SimpleTestCase):
"this is a long\nparagraph of\ntext that\nreally needs\nto be wrapped\n"
"I'm afraid",
)
def test_wrap_long_text(self):
long_text = (
"this is a long paragraph of text that really needs"
" to be wrapped I'm afraid " * 20_000
)
self.assertIn(
"this is a\nlong\nparagraph\nof text\nthat\nreally\nneeds to\nbe wrapped\n"
"I'm afraid",
wordwrap(long_text, 10),
)