diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-12-03 11:55:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 11:55:14 +0100 |
commit | f6d4a63c7f38bf4b707a7d5eb9ddf781072d55cf (patch) | |
tree | d96ebcc3c4b387fa19447f42d6ed5afc6b9d6275 | |
parent | 14f4102ecedcaad8b197a7d83873e55a4936bf05 (diff) |
fix(core): throw on invalid callConsole args (#12973)
Instead of panicking via asserts, since JS-callable code (even Deno.core ...) should not cause process crashes/panics
-rw-r--r-- | core/bindings.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index e4c4e6515..08075e9d5 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -794,10 +794,12 @@ fn call_console( args: v8::FunctionCallbackArguments, _rv: v8::ReturnValue, ) { - assert!(args.length() >= 2); - - assert!(args.get(0).is_function()); - assert!(args.get(1).is_function()); + if args.length() < 2 + || !args.get(0).is_function() + || !args.get(1).is_function() + { + return throw_type_error(scope, "Invalid arguments"); + } let mut call_args = vec![]; for i in 2..args.length() { |