Skip to content

Commit 9123f24

Browse files
authored
Merge pull request #4705 from erik-krogh/bigString
Approved by asgerf
2 parents 2cf10a7 + 2347304 commit 9123f24

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

javascript/ql/src/semmle/javascript/StringOps.qll

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ module StringOps {
574574
not exists(getStringValue()) and
575575
result =
576576
strictconcat(StringLiteralLike leaf |
577-
leaf = getALeaf().asExpr()
577+
leaf = this.(SmallConcatenationRoot).getALeaf().asExpr()
578578
|
579579
leaf.getStringValue()
580580
order by
@@ -583,6 +583,17 @@ module StringOps {
583583
}
584584
}
585585

586+
/**
587+
* A concatenation root where the combined length of the constant parts
588+
* is less than 1 million chars.
589+
*/
590+
private class SmallConcatenationRoot extends ConcatenationRoot {
591+
SmallConcatenationRoot() {
592+
sum(StringLiteralLike leaf | leaf = getALeaf().asExpr() | leaf.getStringValue().length()) <
593+
1000 * 1000
594+
}
595+
}
596+
586597
/** A string literal or template literal without any substitutions. */
587598
private class StringLiteralLike extends Expr {
588599
StringLiteralLike() {

0 commit comments

Comments
 (0)