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

Commit

Permalink
Disallow negative shifts (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored and vncoelho committed Dec 9, 2019
1 parent ac6afb1 commit 8f19980
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/neo-vm/ExecutionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ public class ExecutionEngine : IDisposable
/// <summary>
/// Max value for SHL and SHR
/// </summary>
public virtual int Max_SHL_SHR => 256;

/// <summary>
/// Min value for SHL and SHR
/// </summary>
public virtual int Min_SHL_SHR => -256;
public virtual int MaxShift => 256;

/// <summary>
/// The max size in bytes allowed size for BigInteger
Expand Down Expand Up @@ -79,7 +74,7 @@ public ExecutionEngine()
/// <param name="shift">Shift</param>
/// <returns>Return True if are allowed, otherwise False</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool CheckShift(int shift) => shift <= Max_SHL_SHR && shift >= Min_SHL_SHR;
public bool CheckShift(int shift) => shift <= MaxShift && shift >= 0;

#endregion

Expand Down

0 comments on commit 8f19980

Please sign in to comment.