Skip to content

Commit

Permalink
Fix OOM with JsonSerializer (#2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored Jul 10, 2021
1 parent 1bcbc6b commit cf3a865
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/neo/SmartContract/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static byte[] SerializeToByteArray(StackItem item, uint maxSize)
default:
throw new InvalidOperationException();
}
if (ms.Position > maxSize) throw new InvalidOperationException();
if (ms.Position + writer.BytesPending > maxSize) throw new InvalidOperationException();
}
writer.Flush();
if (ms.Position > maxSize) throw new InvalidOperationException();
Expand Down

0 comments on commit cf3a865

Please sign in to comment.