Skip to content

Commit 9695195

Browse files
authored
Fix "modelled" -> "modeled" spelling in regex PR files
1 parent 918d51c commit 9695195

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

cpp/ql/lib/semmle/code/cpp/regex/RegexFlowConfigs.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* The `regexMatchedAgainst` predicate mirrors the intent of the Java
1414
* `RegexFlowConfigs.qll` library.
1515
*
16-
* All standard `std::regex` grammars are now modelled: ECMAScript (default),
16+
* All standard `std::regex` grammars are now modeled: ECMAScript (default),
1717
* POSIX BRE (`basic`/`grep`), and POSIX ERE (`extended`/`egrep`/`awk`).
1818
* Grammar selection and ReDoS-eligibility are independent axes — see
1919
* `isBacktrackingEngine` for the latter.
@@ -388,24 +388,24 @@ predicate hasNonEcmaScriptGrammarFlag(StringLiteral regex) {
388388
*
389389
* - `Ecma()` — ECMAScript, the default grammar used by `std::regex`.
390390
* Selected either implicitly (no explicit grammar flag) or
391-
* explicitly via `std::regex_constants::ECMAScript`. Modelled
391+
* explicitly via `std::regex_constants::ECMAScript`. Modeled
392392
* by `EcmaRegExp`.
393393
* - `Bre()` — POSIX Basic Regular Expressions (selected via the `basic`
394-
* or `grep` flags). Modelled by `BreRegExp`.
394+
* or `grep` flags). Modeled by `BreRegExp`.
395395
* - `Ere()` — POSIX Extended Regular Expressions (selected via the
396-
* `extended`, `egrep`, or `awk` flags). Modelled by
396+
* `extended`, `egrep`, or `awk` flags). Modeled by
397397
* `EreRegExp`.
398398
*
399399
* All three cases are exercised by the parser today; every grammar has a
400400
* concrete subclass, so `hasConcreteGrammar` holds for every regex the
401401
* parser sees.
402402
*/
403403
newtype TRegexGrammar =
404-
/** The ECMAScript grammar (the default for `std::regex`), modelled by `EcmaRegExp`. */
404+
/** The ECMAScript grammar (the default for `std::regex`), modeled by `EcmaRegExp`. */
405405
Ecma() or
406-
/** The POSIX Basic Regular Expression grammar (`basic`/`grep` flags), modelled by `BreRegExp`. */
406+
/** The POSIX Basic Regular Expression grammar (`basic`/`grep` flags), modeled by `BreRegExp`. */
407407
Bre() or
408-
/** The POSIX Extended Regular Expression grammar (`extended`/`egrep`/`awk` flags), modelled by `EreRegExp`. */
408+
/** The POSIX Extended Regular Expression grammar (`extended`/`egrep`/`awk` flags), modeled by `EreRegExp`. */
409409
Ere()
410410

411411
/**
@@ -432,7 +432,7 @@ TRegexGrammar regexGrammar(StringLiteral regex) {
432432
/**
433433
* Holds if `grammar` has a concrete `RegExp` subclass and can therefore be
434434
* admitted by the parser's characteristic predicate. All three grammars
435-
* (`Ecma()`, `Ere()`, `Bre()`) are modelled today, so this holds for every
435+
* (`Ecma()`, `Ere()`, `Bre()`) are modeled today, so this holds for every
436436
* grammar the standard defines. Kept as a helper so that any future grammar
437437
* scaffolding can be admitted by adding a single disjunct here.
438438
*/

cpp/ql/lib/semmle/code/cpp/regex/internal/ParseRegExp.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* backslash?", "is this a group open?", "is this a quantifier?", etc. — by
1212
* overriding those hooks.
1313
*
14-
* The grammar dialects modelled today are:
14+
* The grammar dialects modeled today are:
1515
* - ECMAScript (`EcmaRegExp`), the default used by `std::regex` (i.e.
1616
* `std::regex_constants::ECMAScript`);
1717
* - POSIX Extended Regular Expressions (`EreRegExp`), selected via the

cpp/ql/test/query-tests/Security/CWE/CWE-1333-ReDoS/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ int main(int argc, char** argv) {
227227

228228
// BAD: exponential regex with icase — case-insensitivity does not suppress the alert.
229229
{ std::regex re("^([a-z]+)+$", std::regex_constants::icase); run(re, input); }
230-
// BAD: BRE grammar (`basic`) is modelled by the parser (`BreRegExp`,
230+
// BAD: BRE grammar (`basic`) is modeled by the parser (`BreRegExp`,
231231
// Phase D) and is backtracking-eligible, so the nested-quantifier is
232232
// reported as exponential. Note that `(...)` in BRE is *literal* — the
233233
// `\(...\)` form used in Section 12 below is the actual group syntax.
234234
// Here `(a+)+` parses in BRE as: literal `(`, literal `a`, literal `+`,
235235
// literal `)`, literal `+` — no backtracking risk, so it is *not*
236236
// flagged (the group-and-quantifier structure disappears).
237237
{ std::regex re("^(a+)+$", std::regex_constants::basic); run(re, input); }
238-
// BAD: extended selects the ERE grammar (modelled by `EreRegExp` since
238+
// BAD: extended selects the ERE grammar (modeled by `EreRegExp` since
239239
// Phase C) and is backtracking-eligible, so the shared engine reports
240240
// the nested-quantifier as exponential — same as the ECMAScript case.
241241
{ std::regex re("^(a+)+$", std::regex_constants::extended); run(re, input); }

cpp/ql/test/query-tests/Security/CWE/CWE-1333/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ int main(int argc, char** argv) {
308308
std::regex_replace(input, re, std::string(""));
309309
}
310310

311-
// GOOD: BRE grammar (`basic`) is now modelled by the parser
311+
// GOOD: BRE grammar (`basic`) is now modeled by the parser
312312
// (`BreRegExp`, Phase D). Under BRE, the pattern `^\s+|\s+$` parses
313313
// as: `^` anchor, literal `\s`, literal `+`, literal `|`, literal
314314
// `\s`, literal `+`, `$` anchor — there is no `+` quantifier in BRE
@@ -319,7 +319,7 @@ int main(int argc, char** argv) {
319319
std::regex re("^\\s+|\\s+$", std::regex_constants::basic);
320320
std::regex_replace(input, re, std::string(""));
321321
}
322-
// BAD: extended selects the ERE grammar (modelled by `EreRegExp` since
322+
// BAD: extended selects the ERE grammar (modeled by `EreRegExp` since
323323
// Phase C) and is backtracking-eligible, so the polynomial engine
324324
// flags the superlinear pattern on user input — same as the
325325
// ECMAScript case.

0 commit comments

Comments
 (0)