Skip to content

Commit c81868b

Browse files
Guillermo Alejandro Gallardo DiezGuillermo Alejandro Gallardo Diez
authored andcommitted
chore: add limit to regexbuilder
1 parent 6d2fc8c commit c81868b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/bridge/effect_adapter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,11 @@ fn parse_cadence(
12271227
.to_string());
12281228
}
12291229
};
1230-
// Validate the pattern compiles as a regex.
1231-
if let Err(e) = regex::Regex::new(pattern) {
1230+
// Validate with the same size limit the engine uses at runtime.
1231+
if let Err(e) = regex::RegexBuilder::new(pattern)
1232+
.size_limit(64 * 1024)
1233+
.build()
1234+
{
12321235
return Err(format!(
12331236
"event pattern '{pattern}' is not a valid regex: {e}"
12341237
));

0 commit comments

Comments
 (0)