File feedparser-issue195.patch of Package python-feedparser.import4444
Index: feedparser-4.1/tests/wellformed/sanitize/item_content_encoded_script_nested_cdata.xml
===================================================================
--- /dev/null
+++ feedparser-4.1/tests/wellformed/sanitize/item_content_encoded_script_nested_cdata.xml
@@ -0,0 +1,11 @@
+<!--
+Description: ensure nested CDATA sections are sanitized properly
+Expect: not bozo and entries[0]['content'][0]['value'] == u'<![CDATA[]]>'
+-->
+<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
+<channel>
+ <item>
+ <content:encoded><![CDATA[<![CDATA[<script></script>]]>]]></content:encoded>
+ </item>
+</channel>
+</rss>
Index: feedparser-4.1/tests/illformed/sanitize/item_content_encoded_script_nested_cdata.xml
===================================================================
--- /dev/null
+++ feedparser-4.1/tests/illformed/sanitize/item_content_encoded_script_nested_cdata.xml
@@ -0,0 +1,11 @@
+<!--
+Description: ensure nested CDATA sections are sanitized properly
+Expect: bozo and entries[0]['content'][0]['value'] == u'<![CDATA[]]>'
+-->
+<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
+<channel>
+ <item>
+ <content:encoded><![CDATA[<![CDATA[<script></script>]]>]]></content:encoded>
+ </item>
+</channel>
+</rss
Index: feedparser-4.1/feedparser.py
===================================================================
--- feedparser-4.1.orig/feedparser.py
+++ feedparser-4.1/feedparser.py
@@ -1649,6 +1649,7 @@ class _HTMLSanitizer(_BaseHTMLProcessor)
def _sanitizeHTML(htmlSource, encoding):
p = _HTMLSanitizer(encoding)
+ htmlSource = htmlSource.replace('<![CDATA[', '<![CDATA[')
p.feed(htmlSource)
data = p.output()
if TIDY_MARKUP: