From 4e0237a1bf6a34ef10b85c2af69d63882365b37f 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index b42c53359..6fa895134 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -295,7 +295,8 @@ 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()); } @@ -351,7 +352,8 @@ 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()); }