summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-21 19:05:55 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-21 19:05:55 +0000
commita36255368091be7401ee3ab1bf33a813e2c953eb (patch)
tree1e7be332a299db569e01010d55e17d67f1243935 /ppapi
parent9b29408f4245086f40f479bf3217cf5f583a443c (diff)
downloadchromium_src-a36255368091be7401ee3ab1bf33a813e2c953eb.zip
chromium_src-a36255368091be7401ee3ab1bf33a813e2c953eb.tar.gz
chromium_src-a36255368091be7401ee3ab1bf33a813e2c953eb.tar.bz2
PPAPI/NaCl: Sanitize CallOnMainThread delay parameter
BUG=116317 TEST=Apps that failed with this don't crash Review URL: https://chromiumcodereview.appspot.com/10961045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/ppb_core_proxy.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc
index ad8773b..6168f49 100644
--- a/ppapi/proxy/ppb_core_proxy.cc
+++ b/ppapi/proxy/ppb_core_proxy.cc
@@ -54,6 +54,12 @@ void CallOnMainThread(int delay_in_ms,
PP_CompletionCallback callback,
int32_t result) {
DCHECK(callback.func);
+#if defined(OS_NACL)
+ // Some NaCl apps pass a negative delay, so we just sanitize to 0, to run as
+ // soon as possible. MessageLoop checks that the delay is non-negative.
+ if (delay_in_ms < 0)
+ delay_in_ms = 0;
+#endif
if (!callback.func)
return;
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(