Fix crash calling GetUserData on a non-user V8 object (fixes issue #3438)

This commit is contained in:
Marshall Greenblatt 2023-01-12 15:55:21 -05:00
parent d0e1ac2d42
commit 4aaeb3eb6c
1 changed files with 6 additions and 4 deletions

View File

@ -291,9 +291,10 @@ class V8TrackObject : public CefTrackNode {
static V8TrackObject* Unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) {
v8::Local<v8::Value> value;
if (GetPrivate(context, object, kCefTrackObject, &value))
if (GetPrivate(context, object, kCefTrackObject, &value) &&
value->IsExternal()) {
return static_cast<V8TrackObject*>(v8::External::Cast(*value)->Value());
}
return nullptr;
}
@ -346,10 +347,11 @@ class V8TrackArrayBuffer : public CefTrackNode {
static V8TrackArrayBuffer* Unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) {
v8::Local<v8::Value> value;
if (GetPrivate(context, object, kCefTrackObject, &value))
if (GetPrivate(context, object, kCefTrackObject, &value) &&
value->IsExternal()) {
return static_cast<V8TrackArrayBuffer*>(
v8::External::Cast(*value)->Value());
}
return nullptr;
}