Skip to content

Commit 8aa5dcd

Browse files
jafinPankraty
andauthored
Bump System.Linq.Dynamic.Core from 1.3.8 to 1.6.0.1 #376 (#377)
* Bump System.Linq.Dynamic.Core from 1.3.8 to 1.6.0.1 #376 Adjust PassNullParameter test, add new case, comment out failing case. See also CVE-2024-51417 zzzprojects/System.Linq.Dynamic.Core#867 * refactor FormulaEvaluatorTest test to Theory * Remove ignored test --------- Co-authored-by: Aleksei <pankraty@gmail.com>
1 parent a428fa4 commit 8aa5dcd

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

ClosedXML.Report/ClosedXML.Report.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<PackageReference Include="ClosedXML" Version="0.102.2" />
4141
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
4242
<PackageReference Include="morelinq" Version="4.1.0" />
43-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8" />
43+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.1" />
4444
</ItemGroup>
4545

4646
</Project>

ClosedXML.Report/FormulaEvaluator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using ClosedXML.Report.Utils;
2-
using DocumentFormat.OpenXml.Bibliography;
32
using System;
43
using System.Collections;
54
using System.Collections.Generic;
65
using System.Globalization;
76
using System.Linq;
7+
using System.Linq.Dynamic.Core.Exceptions;
88
using System.Linq.Expressions;
99
using System.Reflection;
1010
using System.Text.RegularExpressions;
@@ -134,7 +134,7 @@ public class Parameter
134134
{
135135
public Parameter(string name, object value)
136136
{
137-
ParameterExpression = Expression.Parameter(value?.GetType() ?? typeof(string), name);
137+
ParameterExpression = Expression.Parameter(value?.GetType() ?? typeof(object), name);
138138
Value = value;
139139
}
140140

tests/ClosedXML.Report.Tests/ClosedXML.Report.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<PackageReference Include="NSubstitute" Version="5.1.0" />
2424
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
2525
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
26-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8" />
26+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.1" />
2727
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
2828
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.0" />
2929
<PackageReference Include="System.ServiceModel.Primitives" Version="8.0.0" />

tests/ClosedXML.Report.Tests/FormulaEvaluatorTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ public void MultipleExpressionsWithNullResult()
5151
eval.Evaluate("{{b}}{{a}}").Should().Be("1");
5252
}
5353

54-
[Fact]
55-
public void PassNullParameter()
54+
[Theory,
55+
InlineData("{{\"Hello \"+a}}","Hello "),
56+
InlineData("{{\"City: \"+Iif(a==null, string.Empty, a.City)}}","City: ")
57+
]
58+
public void PassNullParameter(string formula, object expected)
5659
{
5760
var eval = new FormulaEvaluator();
58-
eval.Evaluate("{{\"Hello \"+a}}", new Parameter("a", null)).Should().Be("Hello ");
59-
eval.Evaluate("{{1+a}}", new Parameter("a", null)).Should().Be(null);
60-
//TODO: eval.Evaluate("{{\"City: \"+Iif(a==null, string.Empty, a.City}}", new Parameter("a", null)).Should().Be("City: ");
61+
eval.Evaluate(formula, new Parameter("a", null)).Should().Be(expected);
6162
}
6263

6364
[Fact]

0 commit comments

Comments
 (0)