Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: fpdfsdk/include/javascript/JS_Define.h

Issue 1345923002: Check for empty embedder data before using it in PDFium JS bindings. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/include/javascript/JS_Define.h
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index ff9ab48817b23795a81fb9a369eceb1f7e270a28..4b1b224aefc8fb631ac5512d245eddf1d9f6e252 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();
@@ -282,6 +288,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();
@@ -309,6 +317,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();
@@ -333,6 +343,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();
@@ -444,6 +456,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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698