@@ -78,17 +78,21 @@ predicate isDerivedFromLength(DataFlow::Node length, DataFlow::Node operand) {
7878 exists ( IndexOfCall call | operand = call .getAnOperand ( ) |
7979 length = getStringSource ( operand ) .getAPropertyRead ( "length" )
8080 or
81- // Find a literal length with the same string constant
82- exists ( LiteralLengthExpr lengthExpr |
83- lengthExpr .getContainer ( ) = call .getContainer ( ) and
84- lengthExpr .getBaseValue ( ) = operand .asExpr ( ) .getStringValue ( ) and
85- length = lengthExpr .flow ( ) )
86- or
87- // Find an integer constants that equals the length of string constant
88- exists ( Expr lengthExpr |
89- lengthExpr .getContainer ( ) = call .getContainer ( ) and
90- lengthExpr .getIntValue ( ) = operand .asExpr ( ) .getStringValue ( ) .length ( ) and
91- length = lengthExpr .flow ( ) )
81+ exists ( string val | val = operand .asExpr ( ) .getStringValue ( ) |
82+ // Find a literal length with the same string constant
83+ exists ( LiteralLengthExpr lengthExpr |
84+ lengthExpr .getContainer ( ) = call .getContainer ( ) and
85+ lengthExpr .getBaseValue ( ) = val and
86+ length = lengthExpr .flow ( )
87+ )
88+ or
89+ // Find an integer constant that equals the length of string constant
90+ exists ( Expr lengthExpr |
91+ lengthExpr .getContainer ( ) = call .getContainer ( ) and
92+ lengthExpr .getIntValue ( ) = val .length ( ) and
93+ length = lengthExpr .flow ( )
94+ )
95+ )
9296 )
9397 or
9498 isDerivedFromLength ( length .getAPredecessor ( ) , operand )
0 commit comments