Bug 656331 - XPCOM binary component loading never checks mVersion, r=bz
--- a/xpcom/components/Module.h
+++ b/xpcom/components/Module.h
@@ -48,17 +48,17 @@ namespace mozilla {
/**
* A module implements one or more XPCOM components. This structure is used
* for both binary and script modules, but the registration members
* (cids/contractids/categoryentries) are unused for modules which are loaded
* via a module loader.
*/
struct Module
{
- static const int kVersion = 2;
+ static const unsigned int kVersion = 2;
struct CIDEntry;
typedef already_AddRefed<nsIFactory> (*GetFactoryProcPtr)
(const Module& module, const CIDEntry& entry);
typedef nsresult (*ConstructorProcPtr)(nsISupports* aOuter,
const nsIID& aIID,
--- a/xpcom/components/nsNativeComponentLoader.cpp
+++ b/xpcom/components/nsNativeComponentLoader.cpp
@@ -199,17 +199,18 @@ nsNativeModuleLoader::LoadModule(nsILoca
free(blist);
}
#endif
void *module = PR_FindSymbol(data.library, "NSModule");
if (module) {
data.module = *(mozilla::Module const *const *) module;
- if (mLibraries.Put(hashedFile, data))
+ if (mozilla::Module::kVersion == data.module->mVersion &&
+ mLibraries.Put(hashedFile, data))
return data.module;
}
else {
LOG(PR_LOG_ERROR,
("nsNativeModuleLoader::LoadModule(\"%s\") - "
"Symbol NSModule not found", filePath.get()));
}