Merge pull request #6756 from erik-krogh/extractBigReg

JS: extract regexp literals for string concatenations
This commit is contained in:
Erik Krogh Kristensen
2021-11-16 13:33:21 +01:00
committed by GitHub
21 changed files with 4723 additions and 696 deletions

View File

@@ -3,6 +3,8 @@ package com.semmle.js.extractor;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.Stack;
@@ -332,17 +334,28 @@ public class ASTExtractor {
private final Label parent;
private final int childIndex;
private final IdContext idcontext;
private final boolean binopOperand;
public Context(Label parent, int childIndex, IdContext idcontext) {
this(parent, childIndex, idcontext, false);
}
public Context(Label parent, int childIndex, IdContext idcontext, boolean binopOperand) {
this.parent = parent;
this.childIndex = childIndex;
this.idcontext = idcontext;
this.binopOperand = binopOperand;
}
/** True if the visited AST node occurs as part of a type annotation. */
public boolean isInsideType() {
return idcontext.isInsideType();
}
/** True if the visited AST node occurs as one of the operands of a binary operation. */
public boolean isBinopOperand() {
return binopOperand;
}
}
private class V extends DefaultVisitor<Context, Label> {
@@ -358,7 +371,7 @@ public class ASTExtractor {
}
private Label visit(INode child, Label parent, int childIndex) {
return visit(child, parent, childIndex, IdContext.VAR_BIND);
return visit(child, parent, childIndex, IdContext.VAR_BIND, false);
}
private Label visitAll(List<? extends INode> children, Label parent) {
@@ -366,8 +379,16 @@ public class ASTExtractor {
}
private Label visit(INode child, Label parent, int childIndex, IdContext idContext) {
return visit(child, parent, childIndex, idContext, false);
}
private Label visit(INode child, Label parent, int childIndex, boolean binopOperand) {
return visit(child, parent, childIndex, IdContext.VAR_BIND, binopOperand);
}
private Label visit(INode child, Label parent, int childIndex, IdContext idContext, boolean binopOperand) {
if (child == null) return null;
return child.accept(this, new Context(parent, childIndex, idContext));
return child.accept(this, new Context(parent, childIndex, idContext, binopOperand));
}
private Label visitAll(
@@ -379,7 +400,7 @@ public class ASTExtractor {
List<? extends INode> children, Label parent, IdContext idContext, int index, int step) {
Label res = null;
for (INode child : children) {
res = visit(child, parent, index, idContext);
res = visit(child, parent, index, idContext, false);
index += step;
}
return res;
@@ -567,12 +588,17 @@ public class ASTExtractor {
String valueString = nd.getStringValue();
trapwriter.addTuple("literals", valueString, source, key);
Position start = nd.getLoc().getStart();
com.semmle.util.locations.Position startPos = new com.semmle.util.locations.Position(start.getLine(), start.getColumn() + 1 /* Convert from 0-based to 1-based. */, start.getOffset());
if (nd.isRegExp()) {
OffsetTranslation offsets = new OffsetTranslation();
offsets.set(0, 1); // skip the initial '/'
regexpExtractor.extract(source.substring(1, source.lastIndexOf('/')), offsets, nd, false);
} else if (nd.isStringLiteral() && !c.isInsideType() && nd.getRaw().length() < 1000) {
regexpExtractor.extract(valueString, makeStringLiteralOffsets(nd.getRaw()), nd, true);
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getRaw()).offsetBy(0, offsets), startPos);
regexpExtractor.extract(source.substring(1, source.lastIndexOf('/')), sourceMap, nd, false);
} else if (nd.isStringLiteral() && !c.isInsideType() && nd.getRaw().length() < 1000 && !c.isBinopOperand()) {
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getRaw()).offsetBy(0, makeStringLiteralOffsets(nd.getRaw())), startPos);
regexpExtractor.extract(valueString, sourceMap, nd, true);
// Scan the string for template tags, if we're in a context where such tags are relevant.
if (scopeManager.isInTemplateFile()) {
@@ -593,6 +619,38 @@ public class ASTExtractor {
return '0' <= ch && ch <= '7';
}
/**
* Constant-folds simple string concatenations in `exp` while keeping an offset translation
* that tracks back to the original source.
*/
private Pair<String, OffsetTranslation> getStringConcatResult(Expression exp) {
if (exp instanceof BinaryExpression) {
BinaryExpression be = (BinaryExpression) exp;
if (be.getOperator().equals("+")) {
Pair<String, OffsetTranslation> left = getStringConcatResult(be.getLeft());
Pair<String, OffsetTranslation> right = getStringConcatResult(be.getRight());
if (left == null || right == null) {
return null;
}
String str = left.fst() + right.fst();
if (str.length() > 1000) {
return null;
}
int delta = be.getRight().getLoc().getStart().getOffset() - be.getLeft().getLoc().getStart().getOffset();
int offset = left.fst().length();
return Pair.make(str, left.snd().append(right.snd(), offset, delta));
}
} else if (exp instanceof Literal) {
Literal lit = (Literal) exp;
if (!lit.isStringLiteral()) {
return null;
}
return Pair.make(lit.getStringValue(), makeStringLiteralOffsets(lit.getRaw()));
}
return null;
}
/**
* Builds a translation from offsets in a string value back to its original raw literal text
* (including quotes).
@@ -789,11 +847,32 @@ public class ASTExtractor {
@Override
public Label visit(BinaryExpression nd, Context c) {
Label key = super.visit(nd, c);
visit(nd.getLeft(), key, 0);
visit(nd.getRight(), key, 1);
visit(nd.getLeft(), key, 0, true);
visit(nd.getRight(), key, 1, true);
extractRegxpFromBinop(nd, c);
return key;
}
private void extractRegxpFromBinop(BinaryExpression nd, Context c) {
if (c.isBinopOperand()) {
return;
}
Pair<String, OffsetTranslation> concatResult = getStringConcatResult(nd);
if (concatResult == null) {
return;
}
String foldedString = concatResult.fst();
if (foldedString.length() > 1000 && !foldedString.trim().isEmpty()) {
return;
}
OffsetTranslation offsets = concatResult.snd();
Position start = nd.getLoc().getStart();
com.semmle.util.locations.Position startPos = new com.semmle.util.locations.Position(start.getLine(), start.getColumn() + 1 /* Convert from 0-based to 1-based. */, start.getOffset());
SourceMap sourceMap = SourceMap.legacyWithStartPos(SourceMap.fromString(nd.getLoc().getSource()).offsetBy(0, offsets), startPos);
regexpExtractor.extract(foldedString, sourceMap, nd, true);
return;
}
@Override
public Label visit(ComprehensionBlock nd, Context c) {
Label key = super.visit(nd, c);

View File

@@ -43,7 +43,7 @@ public class Main {
* A version identifier that should be updated every time the extractor changes in such a way that
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
*/
public static final String EXTRACTOR_VERSION = "2021-10-25";
public static final String EXTRACTOR_VERSION = "2021-10-28";
public static final Pattern NEWLINE = Pattern.compile("\n");

View File

@@ -43,7 +43,7 @@ import com.semmle.js.ast.regexp.ZeroWidthPositiveLookahead;
import com.semmle.js.ast.regexp.ZeroWidthPositiveLookbehind;
import com.semmle.js.parser.RegExpParser;
import com.semmle.js.parser.RegExpParser.Result;
import com.semmle.util.locations.OffsetTranslation;
import com.semmle.util.locations.SourceMap;
import com.semmle.util.trap.TrapWriter;
import com.semmle.util.trap.TrapWriter.Label;
@@ -52,8 +52,7 @@ public class RegExpExtractor {
private final TrapWriter trapwriter;
private final LocationManager locationManager;
private final RegExpParser parser = new RegExpParser();
private Position literalStart;
private OffsetTranslation offsets;
private SourceMap sourceMap;
public RegExpExtractor(TrapWriter trapwriter, LocationManager locationManager) {
this.trapwriter = trapwriter;
@@ -122,17 +121,16 @@ public class RegExpExtractor {
}
public void emitLocation(SourceElement term, Label lbl) {
int col = literalStart.getColumn();
int sl, sc, el, ec;
sl = el = literalStart.getLine();
sc = col + offsets.get(term.getLoc().getStart().getColumn());
ec = col + offsets.get(term.getLoc().getEnd().getColumn());
sc += 1; // convert to 1-based
ec += 1; // convert to 1-based
ec -= 1; // convert to inclusive
int start = term.getLoc().getStart().getColumn();
int sl = sourceMap.getStart(start).getLine();
int sc = sourceMap.getStart(start).getColumn();
int end = term.getLoc().getEnd().getColumn();
int el = sourceMap.getStart(end).getLine();
int ec = sourceMap.getStart(end).getColumn() - 1; // convert to inclusive
locationManager.emitSnippetLocation(lbl, sl, sc, el, ec);
}
private class V implements Visitor {
private Label parent;
private int idx;
@@ -348,16 +346,13 @@ public class RegExpExtractor {
}
}
public void extract(
String src, OffsetTranslation offsets, Node parent, boolean isSpeculativeParsing) {
public void extract(String src, SourceMap sourceMap, Node parent, boolean isSpeculativeParsing) {
Result res = parser.parse(src);
if (isSpeculativeParsing && res.getErrors().size() > 0) {
return;
}
this.literalStart = parent.getLoc().getStart();
this.offsets = offsets;
this.sourceMap = sourceMap;
RegExpTerm ast = res.getAST();
new V().visit(ast, trapwriter.localID(parent), 0);

View File

@@ -287,150 +287,144 @@ enclosing_stmt(#20097,#20083)
expr_containers(#20097,#20001)
literals("prop","""prop""",#20097)
#20098=*
regexpterm(#20098,14,#20097,0,"prop")
#20099=@"loc,{#10000},3,11,3,14"
locations_default(#20099,#10000,3,11,3,14)
exprs(#20098,13,#20095,1,"Math.random()")
#20099=@"loc,{#10000},3,19,3,31"
locations_default(#20099,#10000,3,19,3,31)
hasLocation(#20098,#20099)
regexp_const_value(#20098,"prop")
enclosing_stmt(#20098,#20083)
expr_containers(#20098,#20001)
#20100=*
exprs(#20100,13,#20095,1,"Math.random()")
#20101=@"loc,{#10000},3,19,3,31"
locations_default(#20101,#10000,3,19,3,31)
exprs(#20100,14,#20098,-1,"Math.random")
#20101=@"loc,{#10000},3,19,3,29"
locations_default(#20101,#10000,3,19,3,29)
hasLocation(#20100,#20101)
enclosing_stmt(#20100,#20083)
expr_containers(#20100,#20001)
#20102=*
exprs(#20102,14,#20100,-1,"Math.random")
#20103=@"loc,{#10000},3,19,3,29"
locations_default(#20103,#10000,3,19,3,29)
hasLocation(#20102,#20103)
exprs(#20102,79,#20100,0,"Math")
hasLocation(#20102,#20037)
enclosing_stmt(#20102,#20083)
expr_containers(#20102,#20001)
literals("Math","Math",#20102)
#20103=@"var;{Math};{#20000}"
variables(#20103,"Math",#20000)
bind(#20102,#20103)
#20104=*
exprs(#20104,79,#20102,0,"Math")
hasLocation(#20104,#20037)
exprs(#20104,0,#20100,1,"random")
hasLocation(#20104,#20041)
enclosing_stmt(#20104,#20083)
expr_containers(#20104,#20001)
literals("Math","Math",#20104)
#20105=@"var;{Math};{#20000}"
variables(#20105,"Math",#20000)
bind(#20104,#20105)
literals("random","random",#20104)
#20105=*
exprs(#20105,3,#20093,1,"23")
hasLocation(#20105,#20051)
enclosing_stmt(#20105,#20083)
expr_containers(#20105,#20001)
literals("23","23",#20105)
is_computed(#20093)
#20106=*
exprs(#20106,0,#20102,1,"random")
hasLocation(#20106,#20041)
enclosing_stmt(#20106,#20083)
expr_containers(#20106,#20001)
literals("random","random",#20106)
properties(#20106,#20091,1,0,"x")
hasLocation(#20106,#20055)
#20107=*
exprs(#20107,3,#20093,1,"23")
hasLocation(#20107,#20051)
exprs(#20107,0,#20106,0,"x")
hasLocation(#20107,#20055)
enclosing_stmt(#20107,#20083)
expr_containers(#20107,#20001)
literals("23","23",#20107)
is_computed(#20093)
literals("x","x",#20107)
#20108=*
properties(#20108,#20091,1,0,"x")
exprs(#20108,79,#20106,1,"x")
hasLocation(#20108,#20055)
enclosing_stmt(#20108,#20083)
expr_containers(#20108,#20001)
literals("x","x",#20108)
bind(#20108,#20081)
#20109=*
exprs(#20109,0,#20108,0,"x")
hasLocation(#20109,#20055)
enclosing_stmt(#20109,#20083)
expr_containers(#20109,#20001)
literals("x","x",#20109)
#20110=*
exprs(#20110,79,#20108,1,"x")
hasLocation(#20110,#20055)
enclosing_stmt(#20110,#20083)
expr_containers(#20110,#20001)
literals("x","x",#20110)
bind(#20110,#20081)
properties(#20109,#20091,2,0,"m() { return 56; }")
#20110=@"loc,{#10000},5,9,5,26"
locations_default(#20110,#10000,5,9,5,26)
hasLocation(#20109,#20110)
#20111=*
properties(#20111,#20091,2,0,"m() { return 56; }")
#20112=@"loc,{#10000},5,9,5,26"
locations_default(#20112,#10000,5,9,5,26)
hasLocation(#20111,#20112)
#20113=*
exprs(#20113,0,#20111,0,"m")
hasLocation(#20113,#20059)
enclosing_stmt(#20113,#20083)
expr_containers(#20113,#20001)
literals("m","m",#20113)
exprs(#20111,0,#20109,0,"m")
hasLocation(#20111,#20059)
enclosing_stmt(#20111,#20083)
expr_containers(#20111,#20001)
literals("m","m",#20111)
#20112=*
exprs(#20112,9,#20109,1,"() { return 56; }")
#20113=@"loc,{#10000},5,10,5,26"
locations_default(#20113,#10000,5,10,5,26)
hasLocation(#20112,#20113)
enclosing_stmt(#20112,#20083)
expr_containers(#20112,#20001)
#20114=*
exprs(#20114,9,#20111,1,"() { return 56; }")
#20115=@"loc,{#10000},5,10,5,26"
locations_default(#20115,#10000,5,10,5,26)
hasLocation(#20114,#20115)
enclosing_stmt(#20114,#20083)
expr_containers(#20114,#20001)
scopes(#20114,1)
scopenodes(#20112,#20114)
scopenesting(#20114,#20000)
#20115=@"var;{arguments};{#20114}"
variables(#20115,"arguments",#20114)
is_arguments_object(#20115)
#20116=*
scopes(#20116,1)
scopenodes(#20114,#20116)
scopenesting(#20116,#20000)
#20117=@"var;{arguments};{#20116}"
variables(#20117,"arguments",#20116)
is_arguments_object(#20117)
stmts(#20116,1,#20112,-2,"{ return 56; }")
#20117=@"loc,{#10000},5,13,5,26"
locations_default(#20117,#10000,5,13,5,26)
hasLocation(#20116,#20117)
stmt_containers(#20116,#20112)
#20118=*
stmts(#20118,1,#20114,-2,"{ return 56; }")
#20119=@"loc,{#10000},5,13,5,26"
locations_default(#20119,#10000,5,13,5,26)
stmts(#20118,9,#20116,0,"return 56;")
#20119=@"loc,{#10000},5,15,5,24"
locations_default(#20119,#10000,5,15,5,24)
hasLocation(#20118,#20119)
stmt_containers(#20118,#20114)
stmt_containers(#20118,#20112)
#20120=*
stmts(#20120,9,#20118,0,"return 56;")
#20121=@"loc,{#10000},5,15,5,24"
locations_default(#20121,#10000,5,15,5,24)
hasLocation(#20120,#20121)
stmt_containers(#20120,#20114)
#20122=*
exprs(#20122,3,#20120,0,"56")
hasLocation(#20122,#20069)
enclosing_stmt(#20122,#20120)
expr_containers(#20122,#20114)
literals("56","56",#20122)
is_method(#20111)
exprs(#20120,3,#20118,0,"56")
hasLocation(#20120,#20069)
enclosing_stmt(#20120,#20118)
expr_containers(#20120,#20112)
literals("56","56",#20120)
is_method(#20109)
#20121=*
entry_cfg_node(#20121,#20001)
#20122=@"loc,{#10000},1,1,1,0"
locations_default(#20122,#10000,1,1,1,0)
hasLocation(#20121,#20122)
#20123=*
entry_cfg_node(#20123,#20001)
#20124=@"loc,{#10000},1,1,1,0"
locations_default(#20124,#10000,1,1,1,0)
hasLocation(#20123,#20124)
#20125=*
exit_cfg_node(#20125,#20001)
hasLocation(#20125,#20079)
exit_cfg_node(#20123,#20001)
hasLocation(#20123,#20079)
successor(#20083,#20086)
successor(#20091,#20097)
successor(#20114,#20111)
successor(#20112,#20109)
#20124=*
entry_cfg_node(#20124,#20112)
#20125=@"loc,{#10000},5,10,5,9"
locations_default(#20125,#10000,5,10,5,9)
hasLocation(#20124,#20125)
#20126=*
entry_cfg_node(#20126,#20114)
#20127=@"loc,{#10000},5,10,5,9"
locations_default(#20127,#10000,5,10,5,9)
exit_cfg_node(#20126,#20112)
#20127=@"loc,{#10000},5,27,5,26"
locations_default(#20127,#10000,5,27,5,26)
hasLocation(#20126,#20127)
#20128=*
exit_cfg_node(#20128,#20114)
#20129=@"loc,{#10000},5,27,5,26"
locations_default(#20129,#10000,5,27,5,26)
hasLocation(#20128,#20129)
successor(#20118,#20122)
successor(#20122,#20120)
successor(#20120,#20128)
successor(#20126,#20118)
successor(#20113,#20114)
successor(#20111,#20088)
successor(#20110,#20108)
successor(#20109,#20110)
successor(#20108,#20113)
successor(#20107,#20093)
successor(#20106,#20102)
successor(#20104,#20106)
successor(#20102,#20100)
successor(#20100,#20095)
successor(#20097,#20104)
successor(#20095,#20107)
successor(#20093,#20109)
successor(#20116,#20120)
successor(#20120,#20118)
successor(#20118,#20126)
successor(#20124,#20116)
successor(#20111,#20112)
successor(#20109,#20088)
successor(#20108,#20106)
successor(#20107,#20108)
successor(#20106,#20111)
successor(#20105,#20093)
successor(#20104,#20100)
successor(#20102,#20104)
successor(#20100,#20098)
successor(#20098,#20095)
successor(#20097,#20102)
successor(#20095,#20105)
successor(#20093,#20107)
successor(#20090,#20091)
successor(#20088,#20125)
successor(#20088,#20123)
successor(#20087,#20084)
successor(#20086,#20087)
successor(#20084,#20090)
successor(#20123,#20083)
successor(#20121,#20083)
numlines(#10000,6,6,0)
filetype(#10000,"javascript")

View File

@@ -468,286 +468,280 @@ enclosing_stmt(#20172,#20168)
expr_containers(#20172,#20157)
literals("values: ","""values: """,#20172)
#20173=*
regexpterm(#20173,14,#20172,0,"values: ")
#20174=@"loc,{#10000},2,11,2,18"
locations_default(#20174,#10000,2,11,2,18)
exprs(#20173,13,#20170,1,"values.join(', ')")
#20174=@"loc,{#10000},2,23,2,39"
locations_default(#20174,#10000,2,23,2,39)
hasLocation(#20173,#20174)
regexp_const_value(#20173,"values: ")
enclosing_stmt(#20173,#20168)
expr_containers(#20173,#20157)
#20175=*
exprs(#20175,13,#20170,1,"values.join(', ')")
#20176=@"loc,{#10000},2,23,2,39"
locations_default(#20176,#10000,2,23,2,39)
exprs(#20175,14,#20173,-1,"values.join")
#20176=@"loc,{#10000},2,23,2,33"
locations_default(#20176,#10000,2,23,2,33)
hasLocation(#20175,#20176)
enclosing_stmt(#20175,#20168)
expr_containers(#20175,#20157)
#20177=*
exprs(#20177,14,#20175,-1,"values.join")
#20178=@"loc,{#10000},2,23,2,33"
locations_default(#20178,#10000,2,23,2,33)
hasLocation(#20177,#20178)
exprs(#20177,79,#20175,0,"values")
hasLocation(#20177,#20043)
enclosing_stmt(#20177,#20168)
expr_containers(#20177,#20157)
literals("values","values",#20177)
bind(#20177,#20163)
#20178=*
exprs(#20178,0,#20175,1,"join")
hasLocation(#20178,#20047)
enclosing_stmt(#20178,#20168)
expr_containers(#20178,#20157)
literals("join","join",#20178)
#20179=*
exprs(#20179,79,#20177,0,"values")
hasLocation(#20179,#20043)
exprs(#20179,4,#20173,0,"', '")
hasLocation(#20179,#20051)
enclosing_stmt(#20179,#20168)
expr_containers(#20179,#20157)
literals("values","values",#20179)
bind(#20179,#20163)
literals(", ","', '",#20179)
#20180=*
exprs(#20180,0,#20177,1,"join")
hasLocation(#20180,#20047)
enclosing_stmt(#20180,#20168)
expr_containers(#20180,#20157)
literals("join","join",#20180)
#20181=*
exprs(#20181,4,#20175,0,"', '")
hasLocation(#20181,#20051)
enclosing_stmt(#20181,#20168)
expr_containers(#20181,#20157)
literals(", ","', '",#20181)
regexpterm(#20180,14,#20179,0,", ")
#20181=@"loc,{#10000},2,36,2,37"
locations_default(#20181,#10000,2,36,2,37)
hasLocation(#20180,#20181)
regexp_const_value(#20180,", ")
#20182=*
regexpterm(#20182,14,#20181,0,", ")
#20183=@"loc,{#10000},2,36,2,37"
locations_default(#20183,#10000,2,36,2,37)
hasLocation(#20182,#20183)
regexp_const_value(#20182,", ")
#20184=*
stmts(#20184,18,#20001,1,"var x = 23;")
hasLocation(#20184,#20011)
stmt_containers(#20184,#20001)
stmts(#20182,18,#20001,1,"var x = 23;")
hasLocation(#20182,#20011)
stmt_containers(#20182,#20001)
#20183=*
exprs(#20183,64,#20182,0,"x = 23")
#20184=@"loc,{#10000},5,5,5,10"
locations_default(#20184,#10000,5,5,5,10)
hasLocation(#20183,#20184)
enclosing_stmt(#20183,#20182)
expr_containers(#20183,#20001)
#20185=*
exprs(#20185,64,#20184,0,"x = 23")
#20186=@"loc,{#10000},5,5,5,10"
locations_default(#20186,#10000,5,5,5,10)
hasLocation(#20185,#20186)
enclosing_stmt(#20185,#20184)
exprs(#20185,78,#20183,0,"x")
hasLocation(#20185,#20060)
enclosing_stmt(#20185,#20182)
expr_containers(#20185,#20001)
literals("x","x",#20185)
decl(#20185,#20155)
#20186=*
exprs(#20186,3,#20183,1,"23")
hasLocation(#20186,#20064)
enclosing_stmt(#20186,#20182)
expr_containers(#20186,#20001)
literals("23","23",#20186)
#20187=*
exprs(#20187,78,#20185,0,"x")
hasLocation(#20187,#20060)
enclosing_stmt(#20187,#20184)
expr_containers(#20187,#20001)
literals("x","x",#20187)
decl(#20187,#20155)
stmts(#20187,18,#20001,2,"var y = 19;")
hasLocation(#20187,#20013)
stmt_containers(#20187,#20001)
#20188=*
exprs(#20188,3,#20185,1,"23")
hasLocation(#20188,#20064)
enclosing_stmt(#20188,#20184)
exprs(#20188,64,#20187,0,"y = 19")
#20189=@"loc,{#10000},6,5,6,10"
locations_default(#20189,#10000,6,5,6,10)
hasLocation(#20188,#20189)
enclosing_stmt(#20188,#20187)
expr_containers(#20188,#20001)
literals("23","23",#20188)
#20189=*
stmts(#20189,18,#20001,2,"var y = 19;")
hasLocation(#20189,#20013)
stmt_containers(#20189,#20001)
#20190=*
exprs(#20190,64,#20189,0,"y = 19")
#20191=@"loc,{#10000},6,5,6,10"
locations_default(#20191,#10000,6,5,6,10)
hasLocation(#20190,#20191)
enclosing_stmt(#20190,#20189)
exprs(#20190,78,#20188,0,"y")
hasLocation(#20190,#20070)
enclosing_stmt(#20190,#20187)
expr_containers(#20190,#20001)
literals("y","y",#20190)
decl(#20190,#20156)
#20191=*
exprs(#20191,3,#20188,1,"19")
hasLocation(#20191,#20074)
enclosing_stmt(#20191,#20187)
expr_containers(#20191,#20001)
literals("19","19",#20191)
#20192=*
exprs(#20192,78,#20190,0,"y")
hasLocation(#20192,#20070)
enclosing_stmt(#20192,#20189)
expr_containers(#20192,#20001)
literals("y","y",#20192)
decl(#20192,#20156)
stmts(#20192,2,#20001,3,"`${x} + ... + y}`;")
hasLocation(#20192,#20015)
stmt_containers(#20192,#20001)
#20193=*
exprs(#20193,3,#20190,1,"19")
hasLocation(#20193,#20074)
enclosing_stmt(#20193,#20189)
exprs(#20193,71,#20192,0,"`${x} + ... x + y}`")
#20194=@"loc,{#10000},7,1,7,24"
locations_default(#20194,#10000,7,1,7,24)
hasLocation(#20193,#20194)
enclosing_stmt(#20193,#20192)
expr_containers(#20193,#20001)
literals("19","19",#20193)
#20194=*
stmts(#20194,2,#20001,3,"`${x} + ... + y}`;")
hasLocation(#20194,#20015)
stmt_containers(#20194,#20001)
#20195=*
exprs(#20195,71,#20194,0,"`${x} + ... x + y}`")
#20196=@"loc,{#10000},7,1,7,24"
locations_default(#20196,#10000,7,1,7,24)
hasLocation(#20195,#20196)
enclosing_stmt(#20195,#20194)
exprs(#20195,79,#20193,0,"x")
hasLocation(#20195,#20084)
enclosing_stmt(#20195,#20192)
expr_containers(#20195,#20001)
literals("x","x",#20195)
bind(#20195,#20155)
#20196=*
exprs(#20196,72,#20193,1," + ")
hasLocation(#20196,#20088)
enclosing_stmt(#20196,#20192)
expr_containers(#20196,#20001)
literals(" + "," + ",#20196)
#20197=*
exprs(#20197,79,#20195,0,"x")
hasLocation(#20197,#20084)
enclosing_stmt(#20197,#20194)
exprs(#20197,79,#20193,2,"y")
hasLocation(#20197,#20092)
enclosing_stmt(#20197,#20192)
expr_containers(#20197,#20001)
literals("x","x",#20197)
bind(#20197,#20155)
literals("y","y",#20197)
bind(#20197,#20156)
#20198=*
exprs(#20198,72,#20195,1," + ")
hasLocation(#20198,#20088)
enclosing_stmt(#20198,#20194)
exprs(#20198,72,#20193,3," = ")
hasLocation(#20198,#20096)
enclosing_stmt(#20198,#20192)
expr_containers(#20198,#20001)
literals(" + "," + ",#20198)
literals(" = "," = ",#20198)
#20199=*
exprs(#20199,79,#20195,2,"y")
hasLocation(#20199,#20092)
enclosing_stmt(#20199,#20194)
exprs(#20199,34,#20193,4,"x + y")
#20200=@"loc,{#10000},7,18,7,22"
locations_default(#20200,#10000,7,18,7,22)
hasLocation(#20199,#20200)
enclosing_stmt(#20199,#20192)
expr_containers(#20199,#20001)
literals("y","y",#20199)
bind(#20199,#20156)
#20200=*
exprs(#20200,72,#20195,3," = ")
hasLocation(#20200,#20096)
enclosing_stmt(#20200,#20194)
expr_containers(#20200,#20001)
literals(" = "," = ",#20200)
#20201=*
exprs(#20201,34,#20195,4,"x + y")
#20202=@"loc,{#10000},7,18,7,22"
locations_default(#20202,#10000,7,18,7,22)
hasLocation(#20201,#20202)
enclosing_stmt(#20201,#20194)
exprs(#20201,79,#20199,0,"x")
hasLocation(#20201,#20100)
enclosing_stmt(#20201,#20192)
expr_containers(#20201,#20001)
literals("x","x",#20201)
bind(#20201,#20155)
#20202=*
exprs(#20202,79,#20199,1,"y")
hasLocation(#20202,#20104)
enclosing_stmt(#20202,#20192)
expr_containers(#20202,#20001)
literals("y","y",#20202)
bind(#20202,#20156)
#20203=*
exprs(#20203,79,#20201,0,"x")
hasLocation(#20203,#20100)
enclosing_stmt(#20203,#20194)
expr_containers(#20203,#20001)
literals("x","x",#20203)
bind(#20203,#20155)
stmts(#20203,2,#20001,4,"tag `${ ... + y}`;")
hasLocation(#20203,#20017)
stmt_containers(#20203,#20001)
#20204=*
exprs(#20204,79,#20201,1,"y")
hasLocation(#20204,#20104)
enclosing_stmt(#20204,#20194)
exprs(#20204,70,#20203,0,"tag `${ ... x + y}`")
#20205=@"loc,{#10000},8,1,8,28"
locations_default(#20205,#10000,8,1,8,28)
hasLocation(#20204,#20205)
enclosing_stmt(#20204,#20203)
expr_containers(#20204,#20001)
literals("y","y",#20204)
bind(#20204,#20156)
#20205=*
stmts(#20205,2,#20001,4,"tag `${ ... + y}`;")
hasLocation(#20205,#20017)
stmt_containers(#20205,#20001)
#20206=*
exprs(#20206,70,#20205,0,"tag `${ ... x + y}`")
#20207=@"loc,{#10000},8,1,8,28"
locations_default(#20207,#10000,8,1,8,28)
hasLocation(#20206,#20207)
enclosing_stmt(#20206,#20205)
exprs(#20206,79,#20204,0,"tag")
hasLocation(#20206,#20114)
enclosing_stmt(#20206,#20203)
expr_containers(#20206,#20001)
#20208=*
exprs(#20208,79,#20206,0,"tag")
hasLocation(#20208,#20114)
enclosing_stmt(#20208,#20205)
expr_containers(#20208,#20001)
literals("tag","tag",#20208)
bind(#20208,#20154)
literals("tag","tag",#20206)
bind(#20206,#20154)
#20207=*
exprs(#20207,71,#20204,1,"`${x} + ... x + y}`")
#20208=@"loc,{#10000},8,5,8,28"
locations_default(#20208,#10000,8,5,8,28)
hasLocation(#20207,#20208)
enclosing_stmt(#20207,#20203)
expr_containers(#20207,#20001)
#20209=*
exprs(#20209,71,#20206,1,"`${x} + ... x + y}`")
#20210=@"loc,{#10000},8,5,8,28"
locations_default(#20210,#10000,8,5,8,28)
hasLocation(#20209,#20210)
enclosing_stmt(#20209,#20205)
exprs(#20209,79,#20207,0,"x")
hasLocation(#20209,#20122)
enclosing_stmt(#20209,#20203)
expr_containers(#20209,#20001)
literals("x","x",#20209)
bind(#20209,#20155)
#20210=*
exprs(#20210,72,#20207,1," + ")
hasLocation(#20210,#20126)
enclosing_stmt(#20210,#20203)
expr_containers(#20210,#20001)
literals(" + "," + ",#20210)
#20211=*
exprs(#20211,79,#20209,0,"x")
hasLocation(#20211,#20122)
enclosing_stmt(#20211,#20205)
exprs(#20211,79,#20207,2,"y")
hasLocation(#20211,#20130)
enclosing_stmt(#20211,#20203)
expr_containers(#20211,#20001)
literals("x","x",#20211)
bind(#20211,#20155)
literals("y","y",#20211)
bind(#20211,#20156)
#20212=*
exprs(#20212,72,#20209,1," + ")
hasLocation(#20212,#20126)
enclosing_stmt(#20212,#20205)
exprs(#20212,72,#20207,3," = ")
hasLocation(#20212,#20134)
enclosing_stmt(#20212,#20203)
expr_containers(#20212,#20001)
literals(" + "," + ",#20212)
literals(" = "," = ",#20212)
#20213=*
exprs(#20213,79,#20209,2,"y")
hasLocation(#20213,#20130)
enclosing_stmt(#20213,#20205)
exprs(#20213,34,#20207,4,"x + y")
#20214=@"loc,{#10000},8,22,8,26"
locations_default(#20214,#10000,8,22,8,26)
hasLocation(#20213,#20214)
enclosing_stmt(#20213,#20203)
expr_containers(#20213,#20001)
literals("y","y",#20213)
bind(#20213,#20156)
#20214=*
exprs(#20214,72,#20209,3," = ")
hasLocation(#20214,#20134)
enclosing_stmt(#20214,#20205)
expr_containers(#20214,#20001)
literals(" = "," = ",#20214)
#20215=*
exprs(#20215,34,#20209,4,"x + y")
#20216=@"loc,{#10000},8,22,8,26"
locations_default(#20216,#10000,8,22,8,26)
hasLocation(#20215,#20216)
enclosing_stmt(#20215,#20205)
exprs(#20215,79,#20213,0,"x")
hasLocation(#20215,#20138)
enclosing_stmt(#20215,#20203)
expr_containers(#20215,#20001)
literals("x","x",#20215)
bind(#20215,#20155)
#20216=*
exprs(#20216,79,#20213,1,"y")
hasLocation(#20216,#20142)
enclosing_stmt(#20216,#20203)
expr_containers(#20216,#20001)
literals("y","y",#20216)
bind(#20216,#20156)
#20217=*
exprs(#20217,79,#20215,0,"x")
hasLocation(#20217,#20138)
enclosing_stmt(#20217,#20205)
expr_containers(#20217,#20001)
literals("x","x",#20217)
bind(#20217,#20155)
#20218=*
exprs(#20218,79,#20215,1,"y")
hasLocation(#20218,#20142)
enclosing_stmt(#20218,#20205)
expr_containers(#20218,#20001)
literals("y","y",#20218)
bind(#20218,#20156)
entry_cfg_node(#20217,#20001)
#20218=@"loc,{#10000},1,1,1,0"
locations_default(#20218,#10000,1,1,1,0)
hasLocation(#20217,#20218)
#20219=*
entry_cfg_node(#20219,#20001)
#20220=@"loc,{#10000},1,1,1,0"
locations_default(#20220,#10000,1,1,1,0)
hasLocation(#20219,#20220)
#20221=*
exit_cfg_node(#20221,#20001)
hasLocation(#20221,#20152)
successor(#20205,#20206)
successor(#20206,#20208)
successor(#20209,#20211)
successor(#20218,#20215)
successor(#20217,#20218)
successor(#20215,#20221)
successor(#20214,#20217)
successor(#20213,#20214)
successor(#20212,#20213)
successor(#20211,#20212)
successor(#20208,#20209)
successor(#20194,#20195)
successor(#20195,#20197)
successor(#20204,#20201)
exit_cfg_node(#20219,#20001)
hasLocation(#20219,#20152)
successor(#20203,#20204)
successor(#20201,#20205)
successor(#20200,#20203)
successor(#20199,#20200)
successor(#20198,#20199)
successor(#20197,#20198)
successor(#20189,#20192)
successor(#20193,#20190)
successor(#20204,#20206)
successor(#20207,#20209)
successor(#20216,#20213)
successor(#20215,#20216)
successor(#20213,#20219)
successor(#20212,#20215)
successor(#20211,#20212)
successor(#20210,#20211)
successor(#20209,#20210)
successor(#20206,#20207)
successor(#20192,#20193)
successor(#20190,#20194)
successor(#20184,#20187)
successor(#20188,#20185)
successor(#20187,#20188)
successor(#20185,#20189)
successor(#20157,#20184)
#20222=*
entry_cfg_node(#20222,#20157)
hasLocation(#20222,#20220)
#20223=*
exit_cfg_node(#20223,#20157)
#20224=@"loc,{#10000},3,2,3,1"
locations_default(#20224,#10000,3,2,3,1)
hasLocation(#20223,#20224)
successor(#20193,#20195)
successor(#20202,#20199)
successor(#20201,#20202)
successor(#20199,#20203)
successor(#20198,#20201)
successor(#20197,#20198)
successor(#20196,#20197)
successor(#20195,#20196)
successor(#20187,#20190)
successor(#20191,#20188)
successor(#20190,#20191)
successor(#20188,#20192)
successor(#20182,#20185)
successor(#20186,#20183)
successor(#20185,#20186)
successor(#20183,#20187)
successor(#20157,#20182)
#20220=*
entry_cfg_node(#20220,#20157)
hasLocation(#20220,#20218)
#20221=*
exit_cfg_node(#20221,#20157)
#20222=@"loc,{#10000},3,2,3,1"
locations_default(#20222,#10000,3,2,3,1)
hasLocation(#20221,#20222)
successor(#20166,#20172)
successor(#20181,#20175)
successor(#20180,#20177)
successor(#20179,#20180)
successor(#20177,#20181)
successor(#20175,#20170)
successor(#20172,#20179)
successor(#20179,#20173)
successor(#20178,#20175)
successor(#20177,#20178)
successor(#20175,#20179)
successor(#20173,#20170)
successor(#20172,#20177)
successor(#20170,#20168)
successor(#20168,#20223)
successor(#20168,#20221)
successor(#20164,#20166)
successor(#20162,#20164)
successor(#20222,#20162)
successor(#20220,#20162)
successor(#20159,#20157)
successor(#20219,#20159)
successor(#20217,#20159)
numlines(#10000,8,7,0)
filetype(#10000,"javascript")

View File

@@ -685,118 +685,112 @@ enclosing_stmt(#20215,#20212)
expr_containers(#20215,#20001)
literals("prototype","'prototype'",#20215)
#20216=*
regexpterm(#20216,14,#20215,0,"prototype")
#20217=@"loc,{#10000},12,2,12,10"
locations_default(#20217,#10000,12,2,12,10)
hasLocation(#20216,#20217)
regexp_const_value(#20216,"prototype")
exprs(#20216,79,#20213,1,"Object")
hasLocation(#20216,#20125)
enclosing_stmt(#20216,#20212)
expr_containers(#20216,#20001)
literals("Object","Object",#20216)
#20217=@"var;{Object};{#20000}"
variables(#20217,"Object",#20000)
bind(#20216,#20217)
#20218=*
exprs(#20218,79,#20213,1,"Object")
hasLocation(#20218,#20125)
enclosing_stmt(#20218,#20212)
expr_containers(#20218,#20001)
literals("Object","Object",#20218)
#20219=@"var;{Object};{#20000}"
variables(#20219,"Object",#20000)
bind(#20218,#20219)
#20220=*
stmts(#20220,2,#20001,12,"[] instanceof Array;")
hasLocation(#20220,#20027)
stmt_containers(#20220,#20001)
stmts(#20218,2,#20001,12,"[] instanceof Array;")
hasLocation(#20218,#20027)
stmt_containers(#20218,#20001)
#20219=*
exprs(#20219,43,#20218,0,"[] instanceof Array")
#20220=@"loc,{#10000},13,1,13,19"
locations_default(#20220,#10000,13,1,13,19)
hasLocation(#20219,#20220)
enclosing_stmt(#20219,#20218)
expr_containers(#20219,#20001)
#20221=*
exprs(#20221,43,#20220,0,"[] instanceof Array")
#20222=@"loc,{#10000},13,1,13,19"
locations_default(#20222,#10000,13,1,13,19)
exprs(#20221,7,#20219,0,"[]")
#20222=@"loc,{#10000},13,1,13,2"
locations_default(#20222,#10000,13,1,13,2)
hasLocation(#20221,#20222)
enclosing_stmt(#20221,#20220)
enclosing_stmt(#20221,#20218)
expr_containers(#20221,#20001)
array_size(#20221,0)
#20223=*
exprs(#20223,7,#20221,0,"[]")
#20224=@"loc,{#10000},13,1,13,2"
locations_default(#20224,#10000,13,1,13,2)
hasLocation(#20223,#20224)
enclosing_stmt(#20223,#20220)
exprs(#20223,79,#20219,1,"Array")
hasLocation(#20223,#20135)
enclosing_stmt(#20223,#20218)
expr_containers(#20223,#20001)
array_size(#20223,0)
literals("Array","Array",#20223)
#20224=@"var;{Array};{#20000}"
variables(#20224,"Array",#20000)
bind(#20223,#20224)
#20225=*
exprs(#20225,79,#20221,1,"Array")
hasLocation(#20225,#20135)
enclosing_stmt(#20225,#20220)
expr_containers(#20225,#20001)
literals("Array","Array",#20225)
#20226=@"var;{Array};{#20000}"
variables(#20226,"Array",#20000)
bind(#20225,#20226)
#20227=*
stmts(#20227,2,#20001,13,"1 && 2;")
hasLocation(#20227,#20029)
stmt_containers(#20227,#20001)
stmts(#20225,2,#20001,13,"1 && 2;")
hasLocation(#20225,#20029)
stmt_containers(#20225,#20001)
#20226=*
exprs(#20226,44,#20225,0,"1 && 2")
#20227=@"loc,{#10000},14,1,14,6"
locations_default(#20227,#10000,14,1,14,6)
hasLocation(#20226,#20227)
enclosing_stmt(#20226,#20225)
expr_containers(#20226,#20001)
#20228=*
exprs(#20228,44,#20227,0,"1 && 2")
#20229=@"loc,{#10000},14,1,14,6"
locations_default(#20229,#10000,14,1,14,6)
hasLocation(#20228,#20229)
enclosing_stmt(#20228,#20227)
exprs(#20228,3,#20226,0,"1")
hasLocation(#20228,#20139)
enclosing_stmt(#20228,#20225)
expr_containers(#20228,#20001)
literals("1","1",#20228)
#20229=*
exprs(#20229,3,#20226,1,"2")
hasLocation(#20229,#20143)
enclosing_stmt(#20229,#20225)
expr_containers(#20229,#20001)
literals("2","2",#20229)
#20230=*
exprs(#20230,3,#20228,0,"1")
hasLocation(#20230,#20139)
enclosing_stmt(#20230,#20227)
expr_containers(#20230,#20001)
literals("1","1",#20230)
stmts(#20230,2,#20001,14,"1 || 2;")
hasLocation(#20230,#20031)
stmt_containers(#20230,#20001)
#20231=*
exprs(#20231,3,#20228,1,"2")
hasLocation(#20231,#20143)
enclosing_stmt(#20231,#20227)
exprs(#20231,45,#20230,0,"1 || 2")
#20232=@"loc,{#10000},15,1,15,6"
locations_default(#20232,#10000,15,1,15,6)
hasLocation(#20231,#20232)
enclosing_stmt(#20231,#20230)
expr_containers(#20231,#20001)
literals("2","2",#20231)
#20232=*
stmts(#20232,2,#20001,14,"1 || 2;")
hasLocation(#20232,#20031)
stmt_containers(#20232,#20001)
#20233=*
exprs(#20233,45,#20232,0,"1 || 2")
#20234=@"loc,{#10000},15,1,15,6"
locations_default(#20234,#10000,15,1,15,6)
hasLocation(#20233,#20234)
enclosing_stmt(#20233,#20232)
exprs(#20233,3,#20231,0,"1")
hasLocation(#20233,#20147)
enclosing_stmt(#20233,#20230)
expr_containers(#20233,#20001)
literals("1","1",#20233)
#20234=*
exprs(#20234,3,#20231,1,"2")
hasLocation(#20234,#20151)
enclosing_stmt(#20234,#20230)
expr_containers(#20234,#20001)
literals("2","2",#20234)
#20235=*
exprs(#20235,3,#20233,0,"1")
hasLocation(#20235,#20147)
enclosing_stmt(#20235,#20232)
expr_containers(#20235,#20001)
literals("1","1",#20235)
#20236=*
exprs(#20236,3,#20233,1,"2")
hasLocation(#20236,#20151)
enclosing_stmt(#20236,#20232)
expr_containers(#20236,#20001)
literals("2","2",#20236)
entry_cfg_node(#20235,#20001)
#20236=@"loc,{#10000},1,1,1,0"
locations_default(#20236,#10000,1,1,1,0)
hasLocation(#20235,#20236)
#20237=*
entry_cfg_node(#20237,#20001)
#20238=@"loc,{#10000},1,1,1,0"
locations_default(#20238,#10000,1,1,1,0)
hasLocation(#20237,#20238)
#20239=*
exit_cfg_node(#20239,#20001)
hasLocation(#20239,#20155)
successor(#20232,#20233)
successor(#20233,#20235)
successor(#20235,#20239)
successor(#20236,#20239)
successor(#20227,#20228)
successor(#20228,#20230)
exit_cfg_node(#20237,#20001)
hasLocation(#20237,#20155)
successor(#20230,#20231)
successor(#20231,#20232)
successor(#20220,#20223)
successor(#20225,#20221)
successor(#20223,#20225)
successor(#20221,#20227)
successor(#20231,#20233)
successor(#20233,#20237)
successor(#20234,#20237)
successor(#20225,#20226)
successor(#20226,#20228)
successor(#20228,#20229)
successor(#20229,#20230)
successor(#20218,#20221)
successor(#20223,#20219)
successor(#20221,#20223)
successor(#20219,#20225)
successor(#20212,#20215)
successor(#20218,#20213)
successor(#20215,#20218)
successor(#20213,#20220)
successor(#20216,#20213)
successor(#20215,#20216)
successor(#20213,#20218)
successor(#20207,#20210)
successor(#20211,#20208)
successor(#20210,#20211)
@@ -841,6 +835,6 @@ successor(#20157,#20160)
successor(#20161,#20158)
successor(#20160,#20161)
successor(#20158,#20162)
successor(#20237,#20157)
successor(#20235,#20157)
numlines(#10000,15,15,0)
filetype(#10000,"javascript")

View File

@@ -571,188 +571,182 @@ enclosing_stmt(#20199,#20181)
expr_containers(#20199,#20001)
literals("a","""a""",#20199)
#20200=*
regexpterm(#20200,14,#20199,0,"a")
#20201=@"loc,{#10000},3,22,3,22"
locations_default(#20201,#10000,3,22,3,22)
hasLocation(#20200,#20201)
regexp_const_value(#20200,"a")
#20202=*
exprs(#20202,4,#20197,1,"""b""")
hasLocation(#20202,#20067)
enclosing_stmt(#20202,#20181)
expr_containers(#20202,#20001)
literals("b","""b""",#20202)
exprs(#20200,4,#20197,1,"""b""")
hasLocation(#20200,#20067)
enclosing_stmt(#20200,#20181)
expr_containers(#20200,#20001)
literals("b","""b""",#20200)
#20201=*
regexpterm(#20201,14,#20197,0,"ab")
#20202=@"loc,{#10000},3,22,3,26"
locations_default(#20202,#10000,3,22,3,26)
hasLocation(#20201,#20202)
regexp_const_value(#20201,"ab")
#20203=*
regexpterm(#20203,14,#20202,0,"b")
#20204=@"loc,{#10000},3,26,3,26"
locations_default(#20204,#10000,3,26,3,26)
hasLocation(#20203,#20204)
regexp_const_value(#20203,"b")
exprs(#20203,79,#20182,-2,"j")
hasLocation(#20203,#20075)
enclosing_stmt(#20203,#20181)
expr_containers(#20203,#20001)
literals("j","j",#20203)
#20204=@"var;{j};{#20000}"
variables(#20204,"j",#20000)
bind(#20203,#20204)
#20205=*
exprs(#20205,79,#20182,-2,"j")
hasLocation(#20205,#20075)
exprs(#20205,89,#20182,-3,"<k.l><M/></k.l>")
#20206=@"loc,{#10000},3,33,3,47"
locations_default(#20206,#10000,3,33,3,47)
hasLocation(#20205,#20206)
enclosing_stmt(#20205,#20181)
expr_containers(#20205,#20001)
literals("j","j",#20205)
#20206=@"var;{j};{#20000}"
variables(#20206,"j",#20000)
bind(#20205,#20206)
#20207=*
exprs(#20207,89,#20182,-3,"<k.l><M/></k.l>")
#20208=@"loc,{#10000},3,33,3,47"
locations_default(#20208,#10000,3,33,3,47)
exprs(#20207,14,#20205,-1,"k.l")
#20208=@"loc,{#10000},3,34,3,36"
locations_default(#20208,#10000,3,34,3,36)
hasLocation(#20207,#20208)
enclosing_stmt(#20207,#20181)
expr_containers(#20207,#20001)
#20209=*
exprs(#20209,14,#20207,-1,"k.l")
#20210=@"loc,{#10000},3,34,3,36"
locations_default(#20210,#10000,3,34,3,36)
hasLocation(#20209,#20210)
exprs(#20209,79,#20207,0,"k")
hasLocation(#20209,#20081)
enclosing_stmt(#20209,#20181)
expr_containers(#20209,#20001)
literals("k","k",#20209)
#20210=@"var;{k};{#20000}"
variables(#20210,"k",#20000)
bind(#20209,#20210)
#20211=*
exprs(#20211,79,#20209,0,"k")
hasLocation(#20211,#20081)
exprs(#20211,0,#20207,1,"l")
hasLocation(#20211,#20085)
enclosing_stmt(#20211,#20181)
expr_containers(#20211,#20001)
literals("k","k",#20211)
#20212=@"var;{k};{#20000}"
variables(#20212,"k",#20000)
bind(#20211,#20212)
#20213=*
exprs(#20213,0,#20209,1,"l")
hasLocation(#20213,#20085)
enclosing_stmt(#20213,#20181)
expr_containers(#20213,#20001)
literals("l","l",#20213)
literals("l","l",#20211)
#20212=*
exprs(#20212,89,#20205,-2,"<M/>")
#20213=@"loc,{#10000},3,38,3,41"
locations_default(#20213,#10000,3,38,3,41)
hasLocation(#20212,#20213)
enclosing_stmt(#20212,#20181)
expr_containers(#20212,#20001)
#20214=*
exprs(#20214,89,#20207,-2,"<M/>")
#20215=@"loc,{#10000},3,38,3,41"
locations_default(#20215,#10000,3,38,3,41)
hasLocation(#20214,#20215)
exprs(#20214,79,#20212,-1,"M")
hasLocation(#20214,#20091)
enclosing_stmt(#20214,#20181)
expr_containers(#20214,#20001)
literals("M","M",#20214)
#20215=@"var;{M};{#20000}"
variables(#20215,"M",#20000)
bind(#20214,#20215)
#20216=*
exprs(#20216,79,#20214,-1,"M")
hasLocation(#20216,#20091)
enclosing_stmt(#20216,#20181)
expr_containers(#20216,#20001)
literals("M","M",#20216)
#20217=@"var;{M};{#20000}"
variables(#20217,"M",#20000)
bind(#20216,#20217)
#20218=*
stmts(#20218,2,#20001,3,"<n {...props}/>;")
hasLocation(#20218,#20009)
stmt_containers(#20218,#20001)
stmts(#20216,2,#20001,3,"<n {...props}/>;")
hasLocation(#20216,#20009)
stmt_containers(#20216,#20001)
#20217=*
exprs(#20217,89,#20216,0,"<n {...props}/>")
#20218=@"loc,{#10000},4,1,4,15"
locations_default(#20218,#10000,4,1,4,15)
hasLocation(#20217,#20218)
enclosing_stmt(#20217,#20216)
expr_containers(#20217,#20001)
#20219=*
exprs(#20219,89,#20218,0,"<n {...props}/>")
#20220=@"loc,{#10000},4,1,4,15"
locations_default(#20220,#10000,4,1,4,15)
hasLocation(#20219,#20220)
enclosing_stmt(#20219,#20218)
exprs(#20219,0,#20217,-1,"n")
hasLocation(#20219,#20121)
enclosing_stmt(#20219,#20216)
expr_containers(#20219,#20001)
#20221=*
exprs(#20221,0,#20219,-1,"n")
hasLocation(#20221,#20121)
enclosing_stmt(#20221,#20218)
expr_containers(#20221,#20001)
literals("n","n",#20221)
literals("n","n",#20219)
#20220=*
properties(#20220,#20217,0,3,"{...props}")
#20221=@"loc,{#10000},4,4,4,13"
locations_default(#20221,#10000,4,4,4,13)
hasLocation(#20220,#20221)
#20222=*
properties(#20222,#20219,0,3,"{...props}")
#20223=@"loc,{#10000},4,4,4,13"
locations_default(#20223,#10000,4,4,4,13)
hasLocation(#20222,#20223)
#20224=*
exprs(#20224,66,#20222,1,"...props")
hasLocation(#20224,#20223)
enclosing_stmt(#20224,#20218)
expr_containers(#20224,#20001)
exprs(#20222,66,#20220,1,"...props")
hasLocation(#20222,#20221)
enclosing_stmt(#20222,#20216)
expr_containers(#20222,#20001)
#20223=*
exprs(#20223,79,#20222,0,"props")
hasLocation(#20223,#20127)
enclosing_stmt(#20223,#20216)
expr_containers(#20223,#20001)
literals("props","props",#20223)
#20224=@"var;{props};{#20000}"
variables(#20224,"props",#20000)
bind(#20223,#20224)
#20225=*
exprs(#20225,79,#20224,0,"props")
hasLocation(#20225,#20127)
enclosing_stmt(#20225,#20218)
expr_containers(#20225,#20001)
literals("props","props",#20225)
#20226=@"var;{props};{#20000}"
variables(#20226,"props",#20000)
bind(#20225,#20226)
stmts(#20225,2,#20001,4,"<><a/><b/></>")
hasLocation(#20225,#20011)
stmt_containers(#20225,#20001)
#20226=*
exprs(#20226,89,#20225,0,"<><a/><b/></>")
hasLocation(#20226,#20011)
enclosing_stmt(#20226,#20225)
expr_containers(#20226,#20001)
#20227=*
stmts(#20227,2,#20001,4,"<><a/><b/></>")
hasLocation(#20227,#20011)
stmt_containers(#20227,#20001)
#20228=*
exprs(#20228,89,#20227,0,"<><a/><b/></>")
hasLocation(#20228,#20011)
enclosing_stmt(#20228,#20227)
expr_containers(#20228,#20001)
exprs(#20227,89,#20226,-2,"<a/>")
#20228=@"loc,{#10000},5,3,5,6"
locations_default(#20228,#10000,5,3,5,6)
hasLocation(#20227,#20228)
enclosing_stmt(#20227,#20225)
expr_containers(#20227,#20001)
#20229=*
exprs(#20229,89,#20228,-2,"<a/>")
#20230=@"loc,{#10000},5,3,5,6"
locations_default(#20230,#10000,5,3,5,6)
hasLocation(#20229,#20230)
enclosing_stmt(#20229,#20227)
exprs(#20229,0,#20227,-1,"a")
hasLocation(#20229,#20143)
enclosing_stmt(#20229,#20225)
expr_containers(#20229,#20001)
#20231=*
exprs(#20231,0,#20229,-1,"a")
hasLocation(#20231,#20143)
enclosing_stmt(#20231,#20227)
expr_containers(#20231,#20001)
literals("a","a",#20231)
literals("a","a",#20229)
#20230=*
exprs(#20230,89,#20226,-3,"<b/>")
#20231=@"loc,{#10000},5,7,5,10"
locations_default(#20231,#10000,5,7,5,10)
hasLocation(#20230,#20231)
enclosing_stmt(#20230,#20225)
expr_containers(#20230,#20001)
#20232=*
exprs(#20232,89,#20228,-3,"<b/>")
#20233=@"loc,{#10000},5,7,5,10"
locations_default(#20233,#10000,5,7,5,10)
hasLocation(#20232,#20233)
enclosing_stmt(#20232,#20227)
exprs(#20232,0,#20230,-1,"b")
hasLocation(#20232,#20151)
enclosing_stmt(#20232,#20225)
expr_containers(#20232,#20001)
#20234=*
exprs(#20234,0,#20232,-1,"b")
hasLocation(#20234,#20151)
enclosing_stmt(#20234,#20227)
expr_containers(#20234,#20001)
literals("b","b",#20234)
literals("b","b",#20232)
#20233=*
entry_cfg_node(#20233,#20001)
#20234=@"loc,{#10000},1,1,1,0"
locations_default(#20234,#10000,1,1,1,0)
hasLocation(#20233,#20234)
#20235=*
entry_cfg_node(#20235,#20001)
#20236=@"loc,{#10000},1,1,1,0"
locations_default(#20236,#10000,1,1,1,0)
hasLocation(#20235,#20236)
#20237=*
exit_cfg_node(#20237,#20001)
hasLocation(#20237,#20163)
successor(#20227,#20231)
successor(#20234,#20232)
successor(#20232,#20228)
successor(#20231,#20229)
successor(#20229,#20234)
successor(#20228,#20237)
successor(#20218,#20221)
successor(#20225,#20224)
successor(#20224,#20222)
successor(#20222,#20219)
successor(#20221,#20225)
successor(#20219,#20227)
exit_cfg_node(#20235,#20001)
hasLocation(#20235,#20163)
successor(#20225,#20229)
successor(#20232,#20230)
successor(#20230,#20226)
successor(#20229,#20227)
successor(#20227,#20232)
successor(#20226,#20235)
successor(#20216,#20219)
successor(#20223,#20222)
successor(#20222,#20220)
successor(#20220,#20217)
successor(#20219,#20223)
successor(#20217,#20225)
successor(#20181,#20184)
successor(#20216,#20214)
successor(#20214,#20207)
successor(#20213,#20209)
successor(#20211,#20213)
successor(#20209,#20216)
successor(#20207,#20182)
successor(#20205,#20211)
successor(#20202,#20197)
successor(#20199,#20202)
successor(#20214,#20212)
successor(#20212,#20205)
successor(#20211,#20207)
successor(#20209,#20211)
successor(#20207,#20214)
successor(#20205,#20182)
successor(#20203,#20209)
successor(#20200,#20197)
successor(#20199,#20200)
successor(#20197,#20194)
successor(#20196,#20199)
successor(#20194,#20205)
successor(#20194,#20203)
successor(#20191,#20185)
successor(#20190,#20187)
successor(#20189,#20190)
successor(#20187,#20191)
successor(#20185,#20196)
successor(#20184,#20189)
successor(#20182,#20218)
successor(#20182,#20216)
successor(#20169,#20174)
successor(#20180,#20178)
successor(#20179,#20180)
@@ -765,6 +759,6 @@ successor(#20170,#20181)
successor(#20165,#20168)
successor(#20168,#20166)
successor(#20166,#20169)
successor(#20235,#20165)
successor(#20233,#20165)
numlines(#10000,5,5,0)
filetype(#10000,"javascript")

View File

@@ -0,0 +1,31 @@
var reg = new RegExp("foo" + "bar");
var reg2 = new RegExp("foo"
+ "bar");
var reg3 = new RegExp(
"foo" + "bar");
var reg4 = new RegExp(
"foo" +
"bar" +
"baz" +
"qux"
);
var bad95 = new RegExp(
"(a" +
"|" +
"aa)*" +
"b$"
);
var bad96 = new RegExp("(" +
"(c|cc)*|" +
"(d|dd)*|" +
"(e|ee)*" +
")f$");
var bad97 = new RegExp(
"(g|gg" +
")*h$");

File diff suppressed because it is too large Load Diff

View File

@@ -235,109 +235,97 @@ enclosing_stmt(#20079,#20073)
expr_containers(#20079,#20063)
literals("Hello, ","""Hello, """,#20079)
#20080=*
regexpterm(#20080,14,#20079,0,"Hello, ")
#20081=@"loc,{#10000},2,13,2,19"
locations_default(#20081,#10000,2,13,2,19)
hasLocation(#20080,#20081)
regexp_const_value(#20080,"Hello, ")
exprs(#20080,79,#20077,1,"person")
hasLocation(#20080,#20035)
enclosing_stmt(#20080,#20073)
expr_containers(#20080,#20063)
literals("person","person",#20080)
bind(#20080,#20067)
#20081=*
exprs(#20081,4,#20075,1,"""!""")
hasLocation(#20081,#20039)
enclosing_stmt(#20081,#20073)
expr_containers(#20081,#20063)
literals("!","""!""",#20081)
#20082=*
exprs(#20082,79,#20077,1,"person")
hasLocation(#20082,#20035)
enclosing_stmt(#20082,#20073)
expr_containers(#20082,#20063)
literals("person","person",#20082)
bind(#20082,#20067)
stmts(#20082,2,#20001,1,"alert(g ... rld""));")
hasLocation(#20082,#20011)
stmt_containers(#20082,#20001)
#20083=*
exprs(#20083,4,#20075,1,"""!""")
hasLocation(#20083,#20039)
enclosing_stmt(#20083,#20073)
expr_containers(#20083,#20063)
literals("!","""!""",#20083)
#20084=*
regexpterm(#20084,14,#20083,0,"!")
#20085=@"loc,{#10000},2,34,2,34"
locations_default(#20085,#10000,2,34,2,34)
hasLocation(#20084,#20085)
regexp_const_value(#20084,"!")
#20086=*
stmts(#20086,2,#20001,1,"alert(g ... rld""));")
hasLocation(#20086,#20011)
stmt_containers(#20086,#20001)
exprs(#20083,13,#20082,0,"alert(g ... orld""))")
#20084=@"loc,{#10000},5,1,5,23"
locations_default(#20084,#10000,5,1,5,23)
hasLocation(#20083,#20084)
enclosing_stmt(#20083,#20082)
expr_containers(#20083,#20001)
#20085=*
exprs(#20085,79,#20083,-1,"alert")
hasLocation(#20085,#20044)
enclosing_stmt(#20085,#20082)
expr_containers(#20085,#20001)
literals("alert","alert",#20085)
#20086=@"var;{alert};{#20000}"
variables(#20086,"alert",#20000)
bind(#20085,#20086)
#20087=*
exprs(#20087,13,#20086,0,"alert(g ... orld""))")
#20088=@"loc,{#10000},5,1,5,23"
locations_default(#20088,#10000,5,1,5,23)
exprs(#20087,13,#20083,0,"greeter(""world"")")
#20088=@"loc,{#10000},5,7,5,22"
locations_default(#20088,#10000,5,7,5,22)
hasLocation(#20087,#20088)
enclosing_stmt(#20087,#20086)
enclosing_stmt(#20087,#20082)
expr_containers(#20087,#20001)
#20089=*
exprs(#20089,79,#20087,-1,"alert")
hasLocation(#20089,#20044)
enclosing_stmt(#20089,#20086)
exprs(#20089,79,#20087,-1,"greeter")
hasLocation(#20089,#20048)
enclosing_stmt(#20089,#20082)
expr_containers(#20089,#20001)
literals("alert","alert",#20089)
#20090=@"var;{alert};{#20000}"
variables(#20090,"alert",#20000)
bind(#20089,#20090)
literals("greeter","greeter",#20089)
bind(#20089,#20062)
#20090=*
exprs(#20090,4,#20087,0,"""world""")
hasLocation(#20090,#20052)
enclosing_stmt(#20090,#20082)
expr_containers(#20090,#20001)
literals("world","""world""",#20090)
#20091=*
exprs(#20091,13,#20087,0,"greeter(""world"")")
#20092=@"loc,{#10000},5,7,5,22"
locations_default(#20092,#10000,5,7,5,22)
regexpterm(#20091,14,#20090,0,"world")
#20092=@"loc,{#10000},5,16,5,20"
locations_default(#20092,#10000,5,16,5,20)
hasLocation(#20091,#20092)
enclosing_stmt(#20091,#20086)
expr_containers(#20091,#20001)
regexp_const_value(#20091,"world")
#20093=*
exprs(#20093,79,#20091,-1,"greeter")
hasLocation(#20093,#20048)
enclosing_stmt(#20093,#20086)
expr_containers(#20093,#20001)
literals("greeter","greeter",#20093)
bind(#20093,#20062)
#20094=*
exprs(#20094,4,#20091,0,"""world""")
hasLocation(#20094,#20052)
enclosing_stmt(#20094,#20086)
expr_containers(#20094,#20001)
literals("world","""world""",#20094)
entry_cfg_node(#20093,#20001)
#20094=@"loc,{#10000},1,1,1,0"
locations_default(#20094,#10000,1,1,1,0)
hasLocation(#20093,#20094)
#20095=*
regexpterm(#20095,14,#20094,0,"world")
#20096=@"loc,{#10000},5,16,5,20"
locations_default(#20096,#10000,5,16,5,20)
hasLocation(#20095,#20096)
regexp_const_value(#20095,"world")
exit_cfg_node(#20095,#20001)
hasLocation(#20095,#20060)
successor(#20082,#20085)
successor(#20090,#20087)
successor(#20089,#20090)
successor(#20087,#20083)
successor(#20085,#20089)
successor(#20083,#20095)
successor(#20063,#20082)
#20096=*
entry_cfg_node(#20096,#20063)
hasLocation(#20096,#20094)
#20097=*
entry_cfg_node(#20097,#20001)
#20098=@"loc,{#10000},1,1,1,0"
locations_default(#20098,#10000,1,1,1,0)
exit_cfg_node(#20097,#20063)
#20098=@"loc,{#10000},3,2,3,1"
locations_default(#20098,#10000,3,2,3,1)
hasLocation(#20097,#20098)
#20099=*
exit_cfg_node(#20099,#20001)
hasLocation(#20099,#20060)
successor(#20086,#20089)
successor(#20094,#20091)
successor(#20093,#20094)
successor(#20091,#20087)
successor(#20089,#20093)
successor(#20087,#20099)
successor(#20063,#20086)
#20100=*
entry_cfg_node(#20100,#20063)
hasLocation(#20100,#20098)
#20101=*
exit_cfg_node(#20101,#20063)
#20102=@"loc,{#10000},3,2,3,1"
locations_default(#20102,#10000,3,2,3,1)
hasLocation(#20101,#20102)
successor(#20071,#20079)
successor(#20083,#20075)
successor(#20082,#20077)
successor(#20079,#20082)
successor(#20077,#20083)
successor(#20081,#20075)
successor(#20080,#20077)
successor(#20079,#20080)
successor(#20077,#20081)
successor(#20075,#20073)
successor(#20073,#20101)
successor(#20073,#20097)
successor(#20068,#20071)
successor(#20100,#20068)
successor(#20096,#20068)
successor(#20065,#20063)
successor(#20097,#20065)
successor(#20093,#20065)
numlines(#10000,5,4,0)
filetype(#10000,"typescript")

View File

@@ -1559,6 +1559,14 @@ class URShiftExpr extends @urshift_expr, BinaryExpr {
*/
class AddExpr extends @add_expr, BinaryExpr {
override string getOperator() { result = "+" }
/**
* Gets the value of this string concatenation parsed as a regular expression, if possible.
*
* All string literals have an associated regular expression tree, provided they can
* be parsed without syntax errors.
*/
RegExpTerm asRegExp() { this = result.getParent() }
}
/**

View File

@@ -155,7 +155,7 @@ class RegExpTerm extends Locatable, @regexpterm {
exists(RegExpParent parent | parent = getRootTerm().getParent() |
parent instanceof RegExpLiteral
or
parent.(StringLiteral).flow() instanceof RegExpPatternSource
parent.(Expr).flow() instanceof RegExpPatternSource
)
}
@@ -1104,6 +1104,30 @@ private class StringRegExpPatternSource extends RegExpPatternSource {
override RegExpTerm getRegExpTerm() { result = asExpr().(StringLiteral).asRegExp() }
}
/**
* A node whose string value may flow to a position where it is interpreted
* as a part of a regular expression.
*/
private class StringConcatRegExpPatternSource extends RegExpPatternSource {
DataFlow::Node parse;
StringConcatRegExpPatternSource() { this = regExpSource(parse) }
override DataFlow::Node getAParse() { result = parse }
override DataFlow::SourceNode getARegExpObject() {
exists(DataFlow::InvokeNode constructor |
constructor = DataFlow::globalVarRef("RegExp").getAnInvocation() and
parse = constructor.getArgument(0) and
result = constructor
)
}
override string getPattern() { result = getStringValue() }
override RegExpTerm getRegExpTerm() { result = asExpr().(AddExpr).asRegExp() }
}
module RegExp {
/** Gets the string `"?"` used to represent a regular expression whose flags are unknown. */
string unknownFlag() { result = "?" }

View File

@@ -855,7 +855,7 @@ regexpterm (unique int id: @regexpterm,
int idx: int ref,
varchar(900) tostring: string ref);
@regexpparent = @regexpterm | @regexp_literal | @string_literal;
@regexpparent = @regexpterm | @regexp_literal | @string_literal | @add_expr;
case @regexpterm.kind of
0 = @regexp_alt

View File

@@ -512,3 +512,8 @@
| tst.js:384:15:384:26 | ([AB]\|[ab])* | Strings with many repetitions of 'A' can start matching anywhere after the start of the preceeding ([AB]\|[ab])*C |
| tst.js:385:14:385:25 | ([DE]\|[de])* | Strings with many repetitions of 'd' can start matching anywhere after the start of the preceeding ([DE]\|[de])*F |
| tst.js:388:14:388:20 | (a\|aa)* | Strings with many repetitions of 'a' can start matching anywhere after the start of the preceeding (a\|aa)*$ |
| tst.js:391:6:394:5 | (a\|aa)* | Strings with many repetitions of 'a' can start matching anywhere after the start of the preceeding (a\|aa)*b$ |
| tst.js:398:6:398:12 | (c\|cc)* | Strings with many repetitions of 'c' can start matching anywhere after the start of the preceeding ((c\|cc)*\|(d\|dd)*\|(e\|ee)*)f$ |
| tst.js:399:6:399:12 | (d\|dd)* | Strings with many repetitions of 'd' can start matching anywhere after the start of the preceeding ((c\|cc)*\|(d\|dd)*\|(e\|ee)*)f$ |
| tst.js:400:6:401:1 | (e\|ee)* | Strings with many repetitions of 'e' can start matching anywhere after the start of the preceeding ((c\|cc)*\|(d\|dd)*\|(e\|ee)*)f$ |
| tst.js:404:6:405:7 | (g\|gg)* | Strings with many repetitions of 'g' can start matching anywhere after the start of the preceeding (g\|gg)*h$ |

View File

@@ -183,3 +183,8 @@
| tst.js:385:14:385:25 | ([DE]\|[de])* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'd'. |
| tst.js:387:27:387:33 | (a\|aa)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'aa'. |
| tst.js:388:14:388:20 | (a\|aa)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'aa'. |
| tst.js:391:6:394:5 | (a\|aa)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'aa'. |
| tst.js:398:6:398:12 | (c\|cc)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'cc'. |
| tst.js:399:6:399:12 | (d\|dd)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'dd'. |
| tst.js:400:6:401:1 | (e\|ee)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'ee'. |
| tst.js:404:6:405:7 | (g\|gg)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'gg'. |

View File

@@ -385,4 +385,21 @@ var good47 = /([AB]|[ab])*C/;
var bad92 = /([DE]|[de])*F/i;
var bad93 = /(?<=^v?|\sv?)(a|aa)*$/;
var bad94 = /(a|aa)*$/;
var bad94 = /(a|aa)*$/;
var bad95 = new RegExp(
"(a" +
"|" +
"aa)*" +
"b$"
);
var bad96 = new RegExp("(" +
"(c|cc)*|" +
"(d|dd)*|" +
"(e|ee)*" +
")f$");
var bad97 = new RegExp(
"(g|gg" +
")*h$");

View File

@@ -15,11 +15,12 @@
| tst-IncompleteHostnameRegExp.js:38:3:38:43 | ^(http\|https):\\/\\/www.example.com\\/p\\/f\\/ | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:38:2:38:44 | /^(http ... p\\/f\\// | here |
| tst-IncompleteHostnameRegExp.js:39:5:39:30 | http:\\/\\/sub.example.com\\/ | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:39:2:39:33 | /^(http ... om\\/)/g | here |
| tst-IncompleteHostnameRegExp.js:40:3:40:29 | ^https?:\\/\\/api.example.com | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:40:2:40:30 | /^https ... le.com/ | here |
| tst-IncompleteHostnameRegExp.js:41:42:41:70 | ^https?://.+\\.example\\.com/ | This string, which is used as a regular expression $@, has an unrestricted wildcard '.+' which may cause 'example\\.com/' to be matched anywhere in the URL, outside the hostname. | tst-IncompleteHostnameRegExp.js:41:13:41:71 | '^http: ... \\.com/' | here |
| tst-IncompleteHostnameRegExp.js:41:42:41:48 | ^https?://.+\\.example\\.com/ | This regular expression has an unrestricted wildcard '.+' which may cause 'example\\.com/' to be matched anywhere in the URL, outside the hostname. | tst-IncompleteHostnameRegExp.js:41:13:41:71 | '^http: ... \\.com/' | here |
| tst-IncompleteHostnameRegExp.js:43:3:43:32 | ^https:\\/\\/[a-z]*.example.com$ | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:43:2:43:33 | /^https ... e.com$/ | here |
| tst-IncompleteHostnameRegExp.js:44:32:44:45 | .+.example.net | This regular expression has an unescaped '.' before 'example.net', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:44:9:44:101 | '^proto ... ernal)' | here |
| tst-IncompleteHostnameRegExp.js:44:47:44:62 | .+.example-a.com | This regular expression has an unescaped '.' before 'example-a.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:44:9:44:101 | '^proto ... ernal)' | here |
| tst-IncompleteHostnameRegExp.js:44:64:44:79 | .+.example-b.com | This regular expression has an unescaped '.' before 'example-b.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:44:9:44:101 | '^proto ... ernal)' | here |
| tst-IncompleteHostnameRegExp.js:48:42:48:68 | ^https?://.+.example\\.com/ | This string, which is used as a regular expression $@, has an unescaped '.' before 'example\\.com/', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:48:13:48:69 | '^http: ... \\.com/' | here |
| tst-IncompleteHostnameRegExp.js:48:42:48:68 | ^https?://.+.example\\.com/ | This string, which is used as a regular expression $@, has an unrestricted wildcard '.+' which may cause 'example\\.com/' to be matched anywhere in the URL, outside the hostname. | tst-IncompleteHostnameRegExp.js:48:13:48:69 | '^http: ... \\.com/' | here |
| tst-IncompleteHostnameRegExp.js:48:42:48:47 | ^https?://.+.example\\.com/ | This regular expression has an unescaped '.' before 'example\\.com/', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:48:13:48:69 | '^http: ... \\.com/' | here |
| tst-IncompleteHostnameRegExp.js:48:42:48:47 | ^https?://.+.example\\.com/ | This regular expression has an unrestricted wildcard '.+' which may cause 'example\\.com/' to be matched anywhere in the URL, outside the hostname. | tst-IncompleteHostnameRegExp.js:48:13:48:69 | '^http: ... \\.com/' | here |
| tst-IncompleteHostnameRegExp.js:53:14:53:35 | test.example.com$ | This regular expression has an unescaped '.' before 'example.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:53:13:53:36 | 'test.' ... e.com$' | here |
| tst-IncompleteHostnameRegExp.js:59:5:59:20 | foo.example\\.com | This regular expression has an unescaped '.' before 'example\\.com', so it might match more hosts than expected. | tst-IncompleteHostnameRegExp.js:59:2:59:32 | /^(foo. ... ever)$/ | here |

View File

@@ -50,7 +50,7 @@
var primary = 'example.com$';
new RegExp('test.' + primary); // NOT OK, but not detected
new RegExp('test.' + 'example.com$'); // NOT OK, but not detected
new RegExp('test.' + 'example.com$'); // NOT OK
new RegExp('^http://test\.example.com'); // NOT OK, but flagged by js/useless-regexp-character-escape

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: add string concatenations as regexp parents
compatibility: backwards