File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
javascript/ql/src/semmle/javascript Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1603,17 +1603,26 @@ private predicate hasAllConstantLeafs(AddExpr add) {
16031603private string getConcatenatedString ( Expr add ) {
16041604 result = getConcatenatedString ( add .getUnderlyingValue ( ) )
16051605 or
1606- not add = getAnAddOperand ( any ( AddExpr parent | hasAllConstantLeafs ( parent ) ) ) and
1607- hasAllConstantLeafs ( add ) and
16081606 result =
16091607 strictconcat ( Expr leaf |
1610- leaf = getAnAddOperand * ( add )
1608+ leaf = getAnAddOperand * ( add . ( SmallConcatRoot ) )
16111609 |
16121610 getConstantString ( leaf )
16131611 order by
16141612 leaf .getLocation ( ) .getStartLine ( ) , leaf .getLocation ( ) .getStartColumn ( )
1615- ) and
1616- result .length ( ) < 1000 * 1000
1613+ )
1614+ }
1615+
1616+ /**
1617+ * An expr that is the root of a string concatenation of constant parts,
1618+ * and the length of the resulting concatenation is less than 1 million chars.
1619+ */
1620+ private class SmallConcatRoot extends Expr {
1621+ SmallConcatRoot ( ) {
1622+ not this = getAnAddOperand ( any ( AddExpr parent | hasAllConstantLeafs ( parent ) ) ) and
1623+ hasAllConstantLeafs ( this ) and
1624+ sum ( Expr leaf | leaf = getAnAddOperand * ( this ) | getConstantString ( leaf ) .length ( ) ) < 1000 * 1000
1625+ }
16171626}
16181627
16191628/**
You can’t perform that action at this time.
0 commit comments