diff options
author | MichaĆ Sabiniarz <31597105+mhvsa@users.noreply.github.com> | 2019-06-07 02:51:04 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-06-06 21:51:04 -0400 |
commit | 9bea576f3ea224ec72f371f6f0bc582171ca7890 (patch) | |
tree | 17a0dbfd8f463ca93e7240e13ec6cbf2bad4b751 /core/libdeno/binding.cc | |
parent | e3b2205eba2851380a9a149071cb4fb7e8218b13 (diff) |
Deno.core.evalContext & Deno.core.print fix (#2465)
Diffstat (limited to 'core/libdeno/binding.cc')
-rw-r--r-- | core/libdeno/binding.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/libdeno/binding.cc b/core/libdeno/binding.cc index 4aeb6003a..f8ef1c7a7 100644 --- a/core/libdeno/binding.cc +++ b/core/libdeno/binding.cc @@ -96,9 +96,11 @@ void PromiseRejectCallback(v8::PromiseRejectMessage promise_reject_message) { } void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { - CHECK_GE(args.Length(), 1); - CHECK_LE(args.Length(), 3); auto* isolate = args.GetIsolate(); + int argsLen = args.Length(); + if (argsLen < 1 || argsLen > 2) { + ThrowInvalidArgument(isolate); + } DenoIsolate* d = DenoIsolate::FromIsolate(isolate); auto context = d->context_.Get(d->isolate_); v8::HandleScope handle_scope(isolate); @@ -375,7 +377,11 @@ void EvalContext(const v8::FunctionCallbackInfo<v8::Value>& args) { auto context = d->context_.Get(isolate); v8::Context::Scope context_scope(context); - CHECK(args[0]->IsString()); + if (!(args[0]->IsString())) { + ThrowInvalidArgument(isolate); + return; + } + auto source = args[0].As<v8::String>(); auto output = v8::Array::New(isolate, 2); |