Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Fault when init with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Dec 14, 2019
1 parent 0c22b69 commit 9e76e51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/neo-vm/ExecutionEngine.cs
Expand Up @@ -432,13 +432,14 @@ private bool ExecuteInstruction()
case OpCode.INITSSLOT:
{
if (context.StaticFields != null) return false;
if (instruction.TokenU8 == 0) break;
if (instruction.TokenU8 == 0) return false;
context.StaticFields = new Slot(instruction.TokenU8, ReferenceCounter);
break;
}
case OpCode.INITSLOT:
{
if (context.LocalVariables != null || context.Arguments != null) return false;
if (instruction.TokenU16 == 0) return false;
if (instruction.TokenU8 > 0)
{
context.LocalVariables = new Slot(instruction.TokenU8, ReferenceCounter);
Expand Down
9 changes: 9 additions & 0 deletions src/neo-vm/Instruction.cs
Expand Up @@ -66,6 +66,15 @@ public string TokenString
}
}

public ushort TokenU16
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return BinaryPrimitives.ReadUInt16LittleEndian(Operand.Span);
}
}

public uint TokenU32
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit 9e76e51

Please sign in to comment.