From 4aaeb3eb6c083b81bc15842db844212150dd481b Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 12 Jan 2023 15:55:21 -0500 Subject: [PATCH] Fix crash calling GetUserData on a non-user V8 object (fixes issue #3438) --- libcef/renderer/v8_impl.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index e91a9133f..414d6de84 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -291,9 +291,10 @@ class V8TrackObject : public CefTrackNode { static V8TrackObject* Unwrap(v8::Local context, v8::Local object) { v8::Local value; - if (GetPrivate(context, object, kCefTrackObject, &value)) + if (GetPrivate(context, object, kCefTrackObject, &value) && + value->IsExternal()) { return static_cast(v8::External::Cast(*value)->Value()); - + } return nullptr; } @@ -346,10 +347,11 @@ class V8TrackArrayBuffer : public CefTrackNode { static V8TrackArrayBuffer* Unwrap(v8::Local context, v8::Local object) { v8::Local value; - if (GetPrivate(context, object, kCefTrackObject, &value)) + if (GetPrivate(context, object, kCefTrackObject, &value) && + value->IsExternal()) { return static_cast( v8::External::Cast(*value)->Value()); - + } return nullptr; }