diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2014-04-22 10:59:13 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2014-04-22 10:59:13 +0000 |
commit | 93043620bc63102f3316bfbec4aab33d06df334b (patch) | |
tree | 8f539a202bc6bdb17f37dbb365198ed4e6e1ae26 /clang/lib/Index/CommentToXML.cpp | |
parent | 6e647c13e451dc57f01e96d1d1dafc8c9b406959 (diff) | |
download | bcm5719-llvm-93043620bc63102f3316bfbec4aab33d06df334b.tar.gz bcm5719-llvm-93043620bc63102f3316bfbec4aab33d06df334b.zip |
Comment parsing: in the generated XML file, mark HTML that is safe to pass
through to the output even if the input comment comes from an untrusted source
Attribute filtering is currently based on a blacklist, which right now includes
all event handler attributes (they contain JavaScipt code). It should be
switched to a whitelist, but going over all of the HTML5 spec requires a
significant amount of time.
llvm-svn: 206882
Diffstat (limited to 'clang/lib/Index/CommentToXML.cpp')
-rw-r--r-- | clang/lib/Index/CommentToXML.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Index/CommentToXML.cpp b/clang/lib/Index/CommentToXML.cpp index 43c423274da..377440f81d5 100644 --- a/clang/lib/Index/CommentToXML.cpp +++ b/clang/lib/Index/CommentToXML.cpp @@ -667,14 +667,20 @@ void CommentASTToXMLConverter::visitInlineCommandComment( void CommentASTToXMLConverter::visitHTMLStartTagComment( const HTMLStartTagComment *C) { - Result << "<rawHTML><![CDATA["; + Result << "<rawHTML"; + if (C->isSafeToPassThrough()) + Result << " isSafeToPassThrough=\"1\""; + Result << "><![CDATA["; printHTMLStartTagComment(C, Result); Result << "]]></rawHTML>"; } void CommentASTToXMLConverter::visitHTMLEndTagComment(const HTMLEndTagComment *C) { - Result << "<rawHTML></" << C->getTagName() << "></rawHTML>"; + Result << "<rawHTML"; + if (C->isSafeToPassThrough()) + Result << " isSafeToPassThrough=\"1\""; + Result << "></" << C->getTagName() << "></rawHTML>"; } void |