diff options
Diffstat (limited to 'vendor/github.com/d5/tengo/objects/builtin_json.go')
-rw-r--r-- | vendor/github.com/d5/tengo/objects/builtin_json.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/github.com/d5/tengo/objects/builtin_json.go b/vendor/github.com/d5/tengo/objects/builtin_json.go index c0810f7d..b3413651 100644 --- a/vendor/github.com/d5/tengo/objects/builtin_json.go +++ b/vendor/github.com/d5/tengo/objects/builtin_json.go @@ -2,6 +2,8 @@ package objects import ( "encoding/json" + + "github.com/d5/tengo" ) // to_json(v object) => bytes @@ -15,6 +17,10 @@ func builtinToJSON(args ...Object) (Object, error) { return &Error{Value: &String{Value: err.Error()}}, nil } + if len(res) > tengo.MaxBytesLen { + return nil, ErrBytesLimit + } + return &Bytes{Value: res}, nil } |