Skip to content

Commit cd5c71e

Browse files
committed
Ruby: cache regExpSource/1 instead of isInterpretedAsRegExp
1 parent 1181779 commit cd5c71e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ruby/ql/lib/codeql/ruby/security/performance/ParseRegExp.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,6 @@ private class ParsedStringRegExp extends RegExp {
983983
/**
984984
* Holds if `source` may be interpreted as a regular expression.
985985
*/
986-
cached
987986
private predicate isInterpretedAsRegExp(DataFlow::Node source) {
988987
// The first argument to an invocation of `Regexp.new` or `Regexp.compile`.
989988
source = API::getTopLevelMember("Regexp").getAMethodCall(["compile", "new"]).getArgument(0)
@@ -1016,4 +1015,5 @@ private DataFlow::Node regExpSource(DataFlow::Node re, TypeBackTracker t) {
10161015
* Gets a node whose value may flow (inter-procedurally) to `re`, where it is interpreted
10171016
* as a part of a regular expression.
10181017
*/
1018+
cached
10191019
DataFlow::Node regExpSource(DataFlow::Node re) { result = regExpSource(re, TypeBackTracker::end()) }

0 commit comments

Comments
 (0)