@@ -163,18 +163,22 @@ private module RegexFlowConfig implements DataFlow::ConfigSig {
163
163
164
164
private module RegexFlow = DataFlow:: Global< RegexFlowConfig > ;
165
165
166
+ private predicate usedAsRegexImpl ( StringLiteral regex , string mode , boolean match_full_string ) {
167
+ RegexFlow:: flow ( DataFlow:: exprNode ( regex ) , _) and
168
+ mode = "None" and // TODO: proper mode detection
169
+ ( if matchesFullString ( regex ) then match_full_string = true else match_full_string = false )
170
+ }
171
+
166
172
/**
167
173
* Holds if `regex` is used as a regex, with the mode `mode` (if known).
168
174
* If regex mode is not known, `mode` will be `"None"`.
169
175
*
170
176
* As an optimisation, only regexes containing an infinite repitition quatifier (`+`, `*`, or `{x,}`)
171
177
* and therefore may be relevant for ReDoS queries are considered.
172
178
*/
173
- predicate usedAsRegex ( StringLiteral regex , string mode , boolean match_full_string ) {
174
- RegexFlow:: flow ( DataFlow:: exprNode ( regex ) , _) and
175
- mode = "None" and // TODO: proper mode detection
176
- ( if matchesFullString ( regex ) then match_full_string = true else match_full_string = false )
177
- }
179
+ overlay [ local]
180
+ predicate usedAsRegex ( StringLiteral regex , string mode , boolean match_full_string ) =
181
+ forceLocal( usedAsRegexImpl / 3 ) ( regex , mode , match_full_string )
178
182
179
183
/**
180
184
* Holds if `regex` is used as a regular expression that is matched against a full string,
0 commit comments