Skip to content

Commit

Permalink
Check UTF8 string
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Aug 16, 2023
1 parent b812394 commit 93b4126
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Neo/SmartContract/ApplicationEngine.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ private static bool CheckItemType(StackItem item, ContractParameterType type)
return aType == StackItemType.Integer;
case ContractParameterType.ByteArray:
case ContractParameterType.String:
return aType is StackItemType.Any or StackItemType.ByteString or StackItemType.Buffer;
return aType is StackItemType.Any or StackItemType.ByteString or StackItemType.Buffer &&
Utility.StrictUTF8.GetString(item.GetSpan()) is not null; // Prevent any non-UTF8 string
case ContractParameterType.Hash160:
if (aType == StackItemType.Any) return true;
if (aType != StackItemType.ByteString && aType != StackItemType.Buffer) return false;
Expand Down

0 comments on commit 93b4126

Please sign in to comment.