summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-09-21 14:15:27 -0700
committerLei Zhang <thestig@chromium.org>2015-09-21 14:15:27 -0700
commit72a40ab98c3ade8f362bba7d7d80783058319e6d (patch)
treea4951b8dc9c106b4042931dae54f46eee10f91d5
parent005b6af7924e44f28eab2c5228fd9eb2538a6c3e (diff)
downloadpdfium-72a40ab98c3ade8f362bba7d7d80783058319e6d.tar.xz
Merge to M46: Check for empty embedder data before using it in PDFium JS bindings.
This was guarded by an assert, but the path is hit. BUG=528015 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1345923002 . (cherry picked from commit 615d7aba0f7d53a78eb05fbd4ae0e1a7e1d3b103) Review URL: https://codereview.chromium.org/1357313002 .
-rw-r--r--fpdfsdk/include/javascript/JS_Define.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index db4b1c360d..b384f3ad34 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -83,6 +83,8 @@ void JSPropGetter(const char* prop_name_string,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pContext = pRuntime->GetCurrentContext();
@@ -111,6 +113,8 @@ void JSPropSetter(const char* prop_name_string,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pContext = pRuntime->GetCurrentContext();
@@ -153,6 +157,8 @@ void JSMethod(const char* method_name_string,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* cc = pRuntime->GetCurrentContext();
@@ -303,6 +309,8 @@ void JSSpecialPropGet(const char* class_name,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
@@ -330,6 +338,8 @@ void JSSpecialPropPut(const char* class_name,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
@@ -354,6 +364,8 @@ void JSSpecialPropDel(const char* class_name,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
@@ -479,6 +491,8 @@ void JSGlobalFunc(const char* func_name_string,
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> v = context->GetEmbedderData(1);
+ if (v.IsEmpty())
+ return;
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(v);
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();
IFXJS_Context* cc = pRuntime->GetCurrentContext();