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

Unified Diff: ppapi/proxy/ppp_class_proxy.cc

Issue 10542150: Actually free plugin implement vars when running out of process when the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | « ppapi/proxy/ppp_class_proxy.h ('k') | ppapi/proxy/ppp_instance_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppp_class_proxy.cc
===================================================================
--- ppapi/proxy/ppp_class_proxy.cc (revision 141525)
+++ ppapi/proxy/ppp_class_proxy.cc (working copy)
@@ -6,10 +6,12 @@
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppp_class_deprecated.h"
+#include "ppapi/c/pp_var.h"
#include "ppapi/proxy/dispatcher.h"
+#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/api_id.h"
namespace ppapi {
@@ -244,6 +246,8 @@
SerializedVarReceiveInput property,
SerializedVarOutParam exception,
bool* result) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
*result = CallWhileUnlocked(ToPPPClass(ppp_class)->HasProperty,
ToUserData(object),
property.Get(dispatcher()),
@@ -254,6 +258,8 @@
SerializedVarReceiveInput property,
SerializedVarOutParam exception,
bool* result) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
*result = CallWhileUnlocked(ToPPPClass(ppp_class)->HasMethod,
ToUserData(object),
property.Get(dispatcher()),
@@ -264,6 +270,8 @@
SerializedVarReceiveInput property,
SerializedVarOutParam exception,
SerializedVarReturnValue result) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
result.Return(dispatcher(), CallWhileUnlocked(
ToPPPClass(ppp_class)->GetProperty,
ToUserData(object), property.Get(dispatcher()),
@@ -274,6 +282,8 @@
int64 ppp_class, int64 object,
std::vector<SerializedVar>* props,
SerializedVarOutParam exception) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
NOTIMPLEMENTED();
// TODO(brettw) implement this.
}
@@ -282,6 +292,8 @@
SerializedVarReceiveInput property,
SerializedVarReceiveInput value,
SerializedVarOutParam exception) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
CallWhileUnlocked(ToPPPClass(ppp_class)->SetProperty,
ToUserData(object), property.Get(dispatcher()), value.Get(dispatcher()),
exception.OutParam(dispatcher()));
@@ -290,6 +302,8 @@
void PPP_Class_Proxy::OnMsgRemoveProperty(int64 ppp_class, int64 object,
SerializedVarReceiveInput property,
SerializedVarOutParam exception) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
CallWhileUnlocked(ToPPPClass(ppp_class)->RemoveProperty,
ToUserData(object), property.Get(dispatcher()),
exception.OutParam(dispatcher()));
@@ -301,6 +315,8 @@
SerializedVarVectorReceiveInput arg_vector,
SerializedVarOutParam exception,
SerializedVarReturnValue result) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
uint32_t arg_count = 0;
PP_Var* args = arg_vector.Get(dispatcher(), &arg_count);
result.Return(dispatcher(), CallWhileUnlocked(ToPPPClass(ppp_class)->Call,
@@ -313,6 +329,8 @@
SerializedVarVectorReceiveInput arg_vector,
SerializedVarOutParam exception,
SerializedVarReturnValue result) {
+ if (!ValidateUserData(ppp_class, object, &exception))
+ return;
uint32_t arg_count = 0;
PP_Var* args = arg_vector.Get(dispatcher(), &arg_count);
result.Return(dispatcher(), CallWhileUnlocked(
@@ -321,8 +339,26 @@
}
void PPP_Class_Proxy::OnMsgDeallocate(int64 ppp_class, int64 object) {
+ if (!ValidateUserData(ppp_class, object, NULL))
+ return;
CallWhileUnlocked(ToPPPClass(ppp_class)->Deallocate, ToUserData(object));
}
+bool PPP_Class_Proxy::ValidateUserData(int64 ppp_class, int64 class_data,
+ SerializedVarOutParam* exception) {
+ if (!PluginGlobals::Get()->plugin_var_tracker()->ValidatePluginObjectCall(
+ ToPPPClass(ppp_class), ToUserData(class_data))) {
+ // Set the exception. This is so the caller will know about the error and
+ // also that we won't assert that somebody forgot to call OutParam on the
+ // output parameter. Although this exception of "1" won't be very useful
+ // this shouldn't happen in normal usage, only when the renderer is being
+ // malicious.
+ if (exception)
+ *exception->OutParam(dispatcher()) = PP_MakeInt32(1);
+ return false;
+ }
+ return true;
+}
+
} // namespace proxy
} // namespace ppapi
« no previous file with comments | « ppapi/proxy/ppp_class_proxy.h ('k') | ppapi/proxy/ppp_instance_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698