Skip to content

Commit 7957b39

Browse files
committedSep 19, 2019
deps: patch V8 to 7.7.299.8
PR-URL: #29336 Refs: v8/v8@7.7.299.4...7.7.299.8 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 90713c6 commit 7957b39

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed
 

‎deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 7
1212
#define V8_MINOR_VERSION 7
1313
#define V8_BUILD_NUMBER 299
14-
#define V8_PATCH_LEVEL 4
14+
#define V8_PATCH_LEVEL 8
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

‎deps/v8/src/builtins/builtins-console.cc

+16
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ void ConsoleCall(
4747
CHECK(!isolate->has_scheduled_exception());
4848
if (!isolate->console_delegate()) return;
4949
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+
5066
debug::ConsoleCallArguments wrapper(args);
5167
Handle<Object> context_id_obj = JSObject::GetDataProperty(
5268
args.target(), isolate->factory()->console_context_id_symbol());

‎deps/v8/src/flags/flag-definitions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ DEFINE_BOOL(enable_one_shot_optimization, true,
361361
"only be executed once")
362362

363363
// 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,
365365
"Enable sealed, frozen elements kind")
366366

367367
// Flags for data representation optimizations

‎deps/v8/test/unittests/api/access-check-unittest.cc

+48
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,52 @@ TEST_F(AccessCheckTest, GetOwnPropertyDescriptor) {
7171
" .set.call(other, 42);");
7272
}
7373

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+
74122
} // namespace v8

0 commit comments

Comments
 (0)
Please sign in to comment.