| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 90713c6 commit 7957b39
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | #define V8_MAJOR_VERSION 7 | |
| 12 | 12 | #define V8_MINOR_VERSION 7 | |
| 13 | 13 | #define V8_BUILD_NUMBER 299 | |
| 14 | - #define V8_PATCH_LEVEL 4 | ||
| 14 | + #define V8_PATCH_LEVEL 8 | ||
| 15 | 15 | ||
| 16 | 16 | // Use 1 for candidates and 0 otherwise. | |
| 17 | 17 | // (Boolean macro values are not supported by all preprocessors.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,22 @@ void ConsoleCall( | |||
| 47 | 47 | CHECK(!isolate->has_scheduled_exception()); | |
| 48 | 48 | if (!isolate->console_delegate()) return; | |
| 49 | 49 | HandleScope scope(isolate); | |
| 50 | + | ||
| 51 | + // Access check. The current context has to match the context of all | ||
| 52 | + // arguments, otherwise the inspector might leak objects across contexts. | ||
| 53 | + Handle<Context> context = handle(isolate->context(), isolate); | ||
| 54 | + for (int i = 0; i < args.length(); ++i) { | ||
| 55 | + Handle<Object> argument = args.at<Object>(i); | ||
| 56 | + if (!argument->IsJSObject()) continue; | ||
| 57 | + | ||
| 58 | + Handle<JSObject> argument_obj = Handle<JSObject>::cast(argument); | ||
| 59 | + if (argument->IsAccessCheckNeeded(isolate) && | ||
| 60 | + !isolate->MayAccess(context, argument_obj)) { | ||
| 61 | + isolate->ReportFailedAccessCheck(argument_obj); | ||
| 62 | + return; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 50 | 66 | debug::ConsoleCallArguments wrapper(args); | |
| 51 | 67 | Handle<Object> context_id_obj = JSObject::GetDataProperty( | |
| 52 | 68 | args.target(), isolate->factory()->console_context_id_symbol()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -361,7 +361,7 @@ DEFINE_BOOL(enable_one_shot_optimization, true, | |||
| 361 | 361 | "only be executed once") | |
| 362 | 362 | ||
| 363 | 363 | // Flag for sealed, frozen elements kind instead of dictionary elements kind | |
| 364 | - DEFINE_BOOL_READONLY(enable_sealed_frozen_elements_kind, true, | ||
| 364 | + DEFINE_BOOL_READONLY(enable_sealed_frozen_elements_kind, false, | ||
| 365 | 365 | "Enable sealed, frozen elements kind") | |
| 366 | 366 | ||
| 367 | 367 | // Flags for data representation optimizations | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,4 +71,52 @@ TEST_F(AccessCheckTest, GetOwnPropertyDescriptor) { | |||
| 71 | 71 | " .set.call(other, 42);"); | |
| 72 | 72 | } | |
| 73 | 73 | ||
| 74 | + namespace { | ||
| 75 | + bool failed_access_check_callback_called; | ||
| 76 | + | ||
| 77 | + v8::Local<v8::String> v8_str(const char* x) { | ||
| 78 | + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x, | ||
| 79 | + v8::NewStringType::kNormal) | ||
| 80 | + .ToLocalChecked(); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + class AccessCheckTestConsoleDelegate : public debug::ConsoleDelegate { | ||
| 84 | + public: | ||
| 85 | + void Log(const debug::ConsoleCallArguments& args, | ||
| 86 | + const debug::ConsoleContext& context) { | ||
| 87 | + FAIL(); | ||
| 88 | + } | ||
| 89 | + }; | ||
| 90 | + | ||
| 91 | + } // namespace | ||
| 92 | + | ||
| 93 | + // Ensure that {console.log} does an access check for its arguments. | ||
| 94 | + TEST_F(AccessCheckTest, ConsoleLog) { | ||
| 95 | + isolate()->SetFailedAccessCheckCallbackFunction( | ||
| 96 | + [](v8::Local<v8::Object> host, v8::AccessType type, | ||
| 97 | + v8::Local<v8::Value> data) { | ||
| 98 | + failed_access_check_callback_called = true; | ||
| 99 | + }); | ||
| 100 | + AccessCheckTestConsoleDelegate console{}; | ||
| 101 | + debug::SetConsoleDelegate(isolate(), &console); | ||
| 102 | + | ||
| 103 | + Local<ObjectTemplate> object_template = ObjectTemplate::New(isolate()); | ||
| 104 | + object_template->SetAccessCheckCallback(AccessCheck); | ||
| 105 | + | ||
| 106 | + Local<Context> context1 = Context::New(isolate(), nullptr); | ||
| 107 | + Local<Context> context2 = Context::New(isolate(), nullptr); | ||
| 108 | + | ||
| 109 | + Local<Object> object1 = | ||
| 110 | + object_template->NewInstance(context1).ToLocalChecked(); | ||
| 111 | + EXPECT_TRUE(context2->Global() | ||
| 112 | + ->Set(context2, v8_str("object_from_context1"), object1) | ||
| 113 | + .IsJust()); | ||
| 114 | + | ||
| 115 | + Context::Scope context_scope(context2); | ||
| 116 | + failed_access_check_callback_called = false; | ||
| 117 | + CompileRun(isolate(), "console.log(object_from_context1);").ToLocalChecked(); | ||
| 118 | + | ||
| 119 | + ASSERT_TRUE(failed_access_check_callback_called); | ||
| 120 | + } | ||
| 121 | + | ||
| 74 | 122 | } // namespace v8 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments