mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
JavaScript: Accept CDATA in E4X content.
This commit is contained in:
@@ -564,7 +564,7 @@ public class CustomParser extends FlowParser {
|
||||
|
||||
@Override
|
||||
protected Either<Integer, Token> jsx_readChunk(StringBuilder out, int chunkStart, int ch) {
|
||||
// skip XML comments and processing instructions (which are allowed in E4X, but not in JSX)
|
||||
// skip XML comments, processing instructions and CDATA (which are allowed in E4X, but not in JSX)
|
||||
if (this.options.e4x() && ch == '<') {
|
||||
if (inputSubstring(this.pos+1, this.pos+4).equals("!--")) {
|
||||
out.append(inputSubstring(chunkStart, this.pos));
|
||||
@@ -576,6 +576,13 @@ public class CustomParser extends FlowParser {
|
||||
this.pos += 2;
|
||||
jsx_readUntil("?>");
|
||||
return Either.left(this.pos);
|
||||
} else if (inputSubstring(this.pos+1, this.pos+9).equals("![CDATA[")) {
|
||||
out.append(inputSubstring(chunkStart, this.pos));
|
||||
this.pos += 9;
|
||||
int cdataStart = this.pos;
|
||||
jsx_readUntil("]]>");
|
||||
out.append(inputSubstring(cdataStart, this.pos-3));
|
||||
return Either.left(this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,4 +9,5 @@ message.soap::[g()];
|
||||
|
||||
var e = <?xml version="1.0" encoding="UTF-8"?> <elt>
|
||||
<!-- comment -->
|
||||
<![CDATA[ some <cdata> ]]>
|
||||
</elt>;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user