Skip to content

Commit f781ca5

Browse files
author
Kapil Borle
committed
Validate range argument in ScriptAnalyzer.Fix method
1 parent 9005f7c commit f781ca5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Engine/ScriptAnalyzer.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,15 @@ public EditableText Fix(EditableText text, Range range, out Range updatedRange)
15591559

15601560
// todo validate range
15611561
var isRangeNull = range == null;
1562+
if (!isRangeNull && !text.IsValidRange(range))
1563+
{
1564+
this.outputWriter.ThrowTerminatingError(new ErrorRecord(
1565+
new ArgumentException("Invalid Range", nameof(range)),
1566+
"FIX_ERROR",
1567+
ErrorCategory.InvalidArgument,
1568+
range));
1569+
}
1570+
15621571
range = isRangeNull ? null : SnapToEdges(text, range);
15631572
var previousLineCount = text.Lines.Length;
15641573
var previousUnusedCorrections = 0;

0 commit comments

Comments
 (0)