From ed62fd757147aac0591a6e1ff611116b0c4eef0e Mon Sep 17 00:00:00 2001 From: Ken Tucker Date: Mon, 4 Nov 2024 20:56:57 -0500 Subject: [PATCH] Make regex in Parser case-insensitive with a timeout Updated LongFormatRegularExpression in the Parser class to be case-insensitive by adding RegexOptions.IgnoreCase. Also set a timeout of 10 seconds using TimeSpan.FromSeconds(10) to prevent potential performance issues from long-running regex operations. --- src/Caliburn.Micro.Platform/Parser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Caliburn.Micro.Platform/Parser.cs b/src/Caliburn.Micro.Platform/Parser.cs index a39bdd0e8..e71166ca1 100644 --- a/src/Caliburn.Micro.Platform/Parser.cs +++ b/src/Caliburn.Micro.Platform/Parser.cs @@ -47,7 +47,7 @@ namespace Caliburn.Micro /// public static class Parser { - static readonly Regex LongFormatRegularExpression = new Regex(@"^[\s]*\[[^\]]*\][\s]*=[\s]*\[[^\]]*\][\s]*$", RegexOptions.Compiled); + static readonly Regex LongFormatRegularExpression = new Regex(@"^[\s]*\[[^\]]*\][\s]*=[\s]*\[[^\]]*\][\s]*$", RegexOptions.Compiled | RegexOptions.IgnoreCase, TimeSpan.FromSeconds(10)); static readonly ILog Log = LogManager.GetLog(typeof(Parser)); ///