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

Unified Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 1004283003: Pepper: add validity checks in RendererPpapiHostImpl::GetDocumentURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: content/renderer/pepper/renderer_ppapi_host_impl.cc
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index bf132d78ff23701d86d34ac19ff8f300eb23353f..948eb77c00abc0d673567d9c9198581c29e1358a 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -260,10 +260,22 @@ void RendererPpapiHostImpl::CreateBrowserResourceHosts(
GURL RendererPpapiHostImpl::GetDocumentURL(PP_Instance instance) const {
PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
- if (!instance_object || !instance_object->container())
+ if (!instance_object)
+ return GURL();
+
+ blink::WebPluginContainer* container = instance_object->container();
+ if (!container)
+ return GURL();
bbudge 2015/03/16 21:50:33 You could replace the lines above with a single ca
dmichael (off chromium) 2015/03/16 21:57:16 Good call, done.
+
+ blink::WebElement element = container->element();
+ if (element.isNull())
+ return GURL();
+
+ blink::WebDocument document = element.document();
+ if (document.isNull())
return GURL();
bbudge 2015/03/16 21:50:33 Are you sure we need these checks? There are a bun
dmichael (off chromium) 2015/03/16 21:57:16 Absolutely not sure. I don't know how we can get i
bbudge 2015/03/16 22:11:29 Looking at other usages, it seems unlikely, but OK
dmichael (off chromium) 2015/03/16 22:16:48 I agree with you. I'm partly doing this to get mor
- return instance_object->container()->element().document().url();
+ return document.url();
}
PepperPluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance(
« 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