summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authortschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 20:40:30 +0000
committertschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 20:40:30 +0000
commitb7c96446ac22ee193c45dc07fe2e9798df7eeab7 (patch)
tree7a82097e67a19a9f1f809ee30c0b55d7536a7b04 /o3d
parent18f6ac530752c99f257288e60e7eb2070dc1ad89 (diff)
downloadchromium_src-b7c96446ac22ee193c45dc07fe2e9798df7eeab7.zip
chromium_src-b7c96446ac22ee193c45dc07fe2e9798df7eeab7.tar.gz
chromium_src-b7c96446ac22ee193c45dc07fe2e9798df7eeab7.tar.bz2
Fix crash on Linux when run by nspluginwrapper due to mismatched width for NPAPI booleans.
BUG=none TEST=ran O3D on Linux with nspluginwrapper Review URL: http://codereview.chromium.org/3801007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/plugin/linux/main_linux.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/o3d/plugin/linux/main_linux.cc b/o3d/plugin/linux/main_linux.cc
index c235f14..6714074 100644
--- a/o3d/plugin/linux/main_linux.cc
+++ b/o3d/plugin/linux/main_linux.cc
@@ -41,6 +41,7 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
+#include "base/third_party/nspr/prtypes.h"
#include "o3d/breakpad/linux/breakpad.h"
#include "plugin/cross/main.h"
#include "plugin/cross/out_of_memory.h"
@@ -658,19 +659,23 @@ NPError InitializePlugin() {
#endif
// Check for XEmbed support in the browser.
- NPBool xembed_support = 0;
+ // Tragically, nspluginwrapper thinks that the type of boolean variables is
+ // supposed to be PRBool, which has size of 4, and not NPBool, which has size
+ // of 1, so we have to use PRBool here so that an integer-sized write by the
+ // plugin host will succeed and not clobber anything else on our stack.
+ PRBool xembed_support = PR_FALSE;
NPError err = NPN_GetValue(NULL, NPNVSupportsXEmbedBool, &xembed_support);
if (err != NPERR_NO_ERROR)
- xembed_support = 0;
+ xembed_support = PR_FALSE;
if (xembed_support) {
// Check for Gtk2 toolkit support in the browser.
NPNToolkitType toolkit = static_cast<NPNToolkitType>(0);
err = NPN_GetValue(NULL, NPNVToolkit, &toolkit);
if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2)
- xembed_support = 0;
+ xembed_support = PR_FALSE;
}
- g_xembed_support = xembed_support != 0;
+ g_xembed_support = xembed_support != PR_FALSE;
return NPERR_NO_ERROR;
}