Skip to content

Commit 1a6e5b4

Browse files
authored
Merge pull request #1114 from Mr-Rm/fix-1113
fix #1113: проверка типа и значения параметра
2 parents c90ff42 + d1df78e commit 1a6e5b4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ScriptEngine.HostedScript/Library/Binary/DataReader.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,16 @@ public IValue SourceStream()
185185
/// </returns>
186186
///
187187
[ContextMethod("Пропустить", "Skip")]
188-
public long Skip(long number)
188+
public long Skip(IValue value)
189189
{
190+
if (value.DataType != DataType.Number)
191+
throw RuntimeException.InvalidArgumentType();
192+
193+
long number = (long)value.AsNumber();
194+
195+
if (number < 0 || number != value.AsNumber())
196+
throw RuntimeException.InvalidArgumentValue();
197+
190198
var stream = _reader.BaseStream;
191199
if (stream.CanSeek)
192200
{

0 commit comments

Comments
 (0)