neoneo-go/pkg
Roman Khimov e34fa2e915 stackitem: limit JSONization nesting level
We can have very deep reference types and attempt to JSONize them can easily
lead to OOM (even though there are no recursive references inside). Therefore
we have to limit them. While regular ToJSON() is buffer size limited to
MaxSize, ToJSONWithTypes is not and limiting it to MaxSize output will require
substantial rewriting effort while not really providing fair result, MaxSize
is more about stack item size while its JSON representation can be much bigger
because of various overheads.

Initial thought was to limit it by element count based on
MaxIteratorResultItems, but the problem here is that we don't always have this
limit in contexts using ToJSONWithTypes (like notification event
marshaling). Thus we need some generic limit which would be fine for all
users.

We at the same time have maxJSONDepth used when deserializing from JSON, so
it can be used for marshaling as well, it's not often that we have deeper
structures in real results.

Inspired by neo-project/neo#2521.
2021-07-06 17:33:16 +03:00
..
compiler compiler/test: compile whole directory in examples 2021-06-28 11:50:40 +03:00
config config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +03:00
consensus crypto: allow to provide non-default scrypt parameters 2021-06-11 15:22:28 +03:00
core mpt: strip branch if 1 child is left 2021-07-05 11:04:20 +03:00
crypto keys: simplify code a bit 2021-06-17 21:55:00 +03:00
encoding *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
interop native/neo: add getAccountState method, close #1975 2021-05-27 10:59:38 +03:00
io *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
network Merge pull request #1997 from nspcc-dev/drop-syncreached-check 2021-06-04 23:39:34 +03:00
rpc compiler: extend permission check to runtime hashes 2021-06-28 11:49:30 +03:00
services *: regenerate test wallets with resources-friendly scrypt parameters 2021-06-11 15:22:32 +03:00
smartcontract callflag: add C#-compliant JSONization, fix #2040 2021-07-06 11:17:12 +03:00
util *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
vm stackitem: limit JSONization nesting level 2021-07-06 17:33:16 +03:00
wallet *: regenerate test wallets with resources-friendly scrypt parameters 2021-06-11 15:22:32 +03:00