Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: Source/core/dom/Document.cpp

Issue 22911020: Block "]]>" in createCDataSection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simpler tests Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 9abe48baba00b2f629cdbe1758e65f34139e8011..5d0debd550512bc11a009959013fed7e063669e7 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -805,6 +805,10 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except
es.throwDOMException(NotSupportedError);
return 0;
}
+ if (data.find("]]>") != WTF::notFound) {
+ es.throwDOMException(InvalidCharacterError, "String cannot contain ']]>' since that is the end delimiter of a CData section.");
+ return 0;
+ }
return CDATASection::create(this, data);
}

Powered by Google App Engine
This is Rietveld 408576698