#24001: strip_tags, html encoding and unicode usage causes MemoryError on short
string
-------------------------------+--------------------
Reporter: twig | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
We noticed some processes were using up to 22gb of memory and throwing
MemoryError exceptions.
Here's some sample code in a django/python shell:
{{{
from django.template.defaultfilters import striptags
value = """<p class="storybody"><h2>Images and Text Do Not
Mix</h2><br><br>This PowerPoint <a
href="http://www.slideshare.net/anilkr123/car-and-technology"
target="_blank">presentation on cars</a> (we know it\u2019s about cars
because an introductory slide consists of the word "CARS" in huge, garish
orange-and-blue letters) puts all of its images in the background (after
applying a little tasteful fading), with <a
href="http://www.pcworld.com/article/7774/make_a_bold_statement_with_text_in_powerpoint.html"
target="_blank">paragraphs of text</a> overlaid on them. This accomplishes
the difficult feat of making the images hard to look at <i>and</i> the
text hard to read. Perfect—a lose-lose situation! <br><br>The
presenter could have consolidated the text in one part of the image, using
the image\u2019s horizontal guiding lines; but that didn\u2019t happen, so
the slide manages to look sloppy as well as unreadable. Bonus points for
misspelling \u201ccarburetor.\u201d</p>"""
striptags(value)
}}}
Removing the "—" after "Perfect" fixes the problem. The character is
the long-dash, most likely copy pasted from Microsoft Word.
Tested with v1.6.8 and v1.7.1
--
Ticket URL: <https://code.djangoproject.com/ticket/24001>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.22f4708545966f880b79036604c062fe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.