From 615d7aba0f7d53a78eb05fbd4ae0e1a7e1d3b103 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 15 Sep 2015 15:42:25 -0700 Subject: 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 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1345923002 . --- fpdfsdk/include/javascript/JS_Define.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'fpdfsdk/include/javascript') diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h index ff9ab48817..4b1b224aef 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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::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 context = isolate->GetCurrentContext(); v8::Local v = context->GetEmbedderData(1); + if (v.IsEmpty()) + return; v8::Local field = v8::Local::Cast(v); IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value(); IFXJS_Context* cc = pRuntime->GetCurrentContext(); -- cgit v1.2.3