Skip to content
Snippets Groups Projects
Commit ba9bdc79 authored by Jakub Konvička's avatar Jakub Konvička
Browse files

security: Disable backtracking at regex

parent 71156027
1 merge request!15merge: develop into main
...@@ -144,8 +144,8 @@ public class CppClassDiagramVisitor : CPP14ParserBaseVisitor<object> ...@@ -144,8 +144,8 @@ public class CppClassDiagramVisitor : CPP14ParserBaseVisitor<object>
string compositionPattern = @"^(?:std::)?(?:vector<)?(\w+)>?$"; string compositionPattern = @"^(?:std::)?(?:vector<)?(\w+)>?$";
// Check if the property type matches aggregation or composition // Check if the property type matches aggregation or composition
Match aggregationMatch = Regex.Match(atribute.Type, aggregationPattern); Match aggregationMatch = Regex.Match(atribute.Type, aggregationPattern, RegexOptions.NonBacktracking);
Match compositionMatch = Regex.Match(atribute.Type, compositionPattern); Match compositionMatch = Regex.Match(atribute.Type, compositionPattern, RegexOptions.NonBacktracking);
int groupMatch = 1; int groupMatch = 1;
if (aggregationMatch.Success && !string.IsNullOrEmpty(aggregationMatch.Groups[groupMatch].Value)) if (aggregationMatch.Success && !string.IsNullOrEmpty(aggregationMatch.Groups[groupMatch].Value))
{ {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment