summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-16 10:03:01 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-16 10:03:01 +0000
commit09fe8bebeb1c9a11719072d67d71cc305baab891 (patch)
tree6491bde9348f88bdf24c40bbeca481ca6d2458b9 /chrome
parentd1c2e5fbfe9d64206c26bfaaa0dcaf9887751c4a (diff)
downloadchromium_src-09fe8bebeb1c9a11719072d67d71cc305baab891.zip
chromium_src-09fe8bebeb1c9a11719072d67d71cc305baab891.tar.gz
chromium_src-09fe8bebeb1c9a11719072d67d71cc305baab891.tar.bz2
Fix problem with %temp% paths not collapsing correctly.
Also update the blacklist so that modules that are not suspected malware don't get linked to the Help Center (the Help Center will only have a malware article to being with). BUG=66885 TEST=Covered by unit test. Review URL: http://codereview.chromium.org/5894001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/enumerate_modules_model_unittest_win.cc31
-rw-r--r--chrome/browser/enumerate_modules_model_win.cc49
-rw-r--r--chrome/browser/enumerate_modules_model_win.h3
3 files changed, 61 insertions, 22 deletions
diff --git a/chrome/browser/enumerate_modules_model_unittest_win.cc b/chrome/browser/enumerate_modules_model_unittest_win.cc
index 841c420..7aa6b63 100644
--- a/chrome/browser/enumerate_modules_model_unittest_win.cc
+++ b/chrome/browser/enumerate_modules_model_unittest_win.cc
@@ -190,3 +190,34 @@ TEST_F(EnumerateModulesTest, MatchFunction) {
ModuleEnumerator::Match(test, blacklist));
}
}
+
+const struct CollapsePathList {
+ string16 expected_result;
+ string16 test_case;
+} kCollapsePathList[] = {
+ // Negative testing (should not collapse this path).
+ { ASCIIToUTF16("c:\\a\\a.dll"), ASCIIToUTF16("c:\\a\\a.dll") },
+ // These two are to test that we select the maximum collapsed path.
+ { ASCIIToUTF16("%foo%\\a.dll"), ASCIIToUTF16("c:\\foo\\a.dll") },
+ { ASCIIToUTF16("%x%\\a.dll"), ASCIIToUTF16("c:\\foo\\bar\\a.dll") },
+};
+
+TEST_F(EnumerateModulesTest, CollapsePath) {
+ scoped_refptr<ModuleEnumerator> module_enumerator(new ModuleEnumerator(NULL));
+ module_enumerator->path_mapping_.clear();
+ module_enumerator->path_mapping_.push_back(
+ std::make_pair(L"c:\\foo\\", L"%foo%"));
+ module_enumerator->path_mapping_.push_back(
+ std::make_pair(L"c:\\foo\\bar\\", L"%x%"));
+
+ for (size_t i = 0; i < arraysize(kCollapsePathList); ++i) {
+ ModuleEnumerator::Module module;
+ module.location = kCollapsePathList[i].test_case;
+ module_enumerator->CollapsePath(&module);
+
+ SCOPED_TRACE("Test case no " + base::IntToString(i) +
+ ": '" + UTF16ToASCII(kCollapsePathList[i].expected_result) +
+ "'");
+ EXPECT_EQ(kCollapsePathList[i].expected_result, module.location);
+ }
+}
diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc
index 24ded4e..9de5c76 100644
--- a/chrome/browser/enumerate_modules_model_win.cc
+++ b/chrome/browser/enumerate_modules_model_win.cc
@@ -115,7 +115,7 @@ const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
{ "5d10b363", "", "", "", "", kUninstallLink },
// icf.dll, "%systemroot%\\system32\\".
- { "303825ed", "23d01d5b", "", "", "", kUninstallLink },
+ { "303825ed", "23d01d5b", "", "", "", INVESTIGATING },
// idmmbc.dll (IDM), "%systemroot%\\system32\\". See: http://crbug.com/26892/.
{ "b8dce5c3", "23d01d5b", "", "", "6.03",
@@ -126,14 +126,13 @@ const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
static_cast<RecommendedAction>(UPDATE | DISABLE) },
// is3lsp.dll, "%commonprogramfiles%\\is3\\anti-spyware\\".
- { "7ffbdce9", "bc5673f2", "", "", "",
- static_cast<RecommendedAction>(UPDATE | DISABLE) },
+ { "7ffbdce9", "bc5673f2", "", "", "", INVESTIGATING },
// jsi.dll, "%programfiles%\\profilecraze\\".
{ "f9555eea", "e3548061", "", "", "", kUninstallLink },
// kernel.dll, "%programfiles%\\contentwatch\\internet protection\\modules\\".
- { "ead2768e", "4e61ce60", "", "", "", kUninstallLink },
+ { "ead2768e", "4e61ce60", "", "", "", INVESTIGATING },
// mgking0.dll, "%systemroot%\\system32\\".
{ "d0893e38", "23d01d5b", "", "", "", kUninstallLink },
@@ -148,7 +147,7 @@ const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
{ "3e837222", "59145acf", "", "", "", kUninstallLink },
// mstcipha.ime, "%systemroot%\\system32\\".
- { "5523579e", "23d01d5b", "", "", "", kUninstallLink },
+ { "5523579e", "23d01d5b", "", "", "", INVESTIGATING },
// mwtsp.dll, "%systemroot%\\system32\\".
{ "9830bff6", "23d01d5b", "", "", "", kUninstallLink },
@@ -158,25 +157,24 @@ const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
// nvlsp.dll,
// "%programfiles%\\nvidia corporation\\networkaccessmanager\\bin32\\".
- { "37f907e2", "3ad0ff23", "", "", "", kUninstallLink },
+ { "37f907e2", "3ad0ff23", "", "", "", INVESTIGATING },
// radhslib.dll (Naomi web filter), "%programfiles%\\rnamfler\\".
// See http://crbug.com/12517.
- { "7edcd250", "0733dc3e", "", "", "", kUninstallLink },
+ { "7edcd250", "0733dc3e", "", "", "", INVESTIGATING },
// rlls.dll, "%programfiles%\\relevantknowledge\\".
{ "a1ed94a7", "ea9d6b36", "", "", "", kUninstallLink },
// rooksdol.dll, "%programfiles%\\trusteer\\rapport\\bin\\".
- { "802aefef", "06120e13", "", "", "", kUninstallLink },
+ { "802aefef", "06120e13", "", "", "", INVESTIGATING },
// searchtree.dll,
// "%programfiles%\\contentwatch\\internet protection\\modules\\".
- { "f6915a31", "4e61ce60", "", "", "", kUninstallLink },
+ { "f6915a31", "4e61ce60", "", "", "", INVESTIGATING },
// sgprxy.dll, "%commonprogramfiles%\\is3\\anti-spyware\\".
- { "005965ea", "bc5673f2", "", "", "",
- static_cast<RecommendedAction>(UPDATE | DISABLE) },
+ { "005965ea", "bc5673f2", "", "", "", INVESTIGATING },
// twking0.dll, "%systemroot%\\system32\\".
{ "0355549b", "23d01d5b", "", "", "", kUninstallLink },
@@ -187,15 +185,15 @@ const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
// vksaver.dll, "%systemroot%\\system32\\".
{ "c4a784d5", "23d01d5b", "", "", "", kUninstallLink },
- // vlsp.dll, "%systemroot%\\system32\\".
- { "2e4eb93d", "23d01d5b", "", "", "", kUninstallLink },
+ // vlsp.dll (Venturi Firewall?), "%systemroot%\\system32\\".
+ { "2e4eb93d", "23d01d5b", "", "", "", INVESTIGATING },
// vmn3_1dn.dll, "%appdata%\\roaming\\vmndtxtb\\".
{ "bba2037d", "9ab68585", "", "", "", kUninstallLink },
// webanalyzer.dll,
// "%programfiles%\\contentwatch\\internet protection\\modules\\".
- { "c70b697d", "4e61ce60", "", "", "", kUninstallLink },
+ { "c70b697d", "4e61ce60", "", "", "", INVESTIGATING },
// wowst0.dll, "%systemroot%\\system32\\".
{ "38ad9963", "23d01d5b", "", "", "", kUninstallLink },
@@ -312,15 +310,15 @@ ModuleEnumerator::ModuleStatus ModuleEnumerator::Match(
}
ModuleEnumerator::ModuleEnumerator(EnumerateModulesModel* observer)
- : observer_(observer) {
- CHECK(BrowserThread::GetCurrentThreadIdentifier(&callback_thread_id_));
- DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ : observer_(observer),
+ callback_thread_id_(BrowserThread::ID_COUNT) {
}
ModuleEnumerator::~ModuleEnumerator() {
}
void ModuleEnumerator::ScanNow(ModulesVector* list) {
+ CHECK(BrowserThread::GetCurrentThreadIdentifier(&callback_thread_id_));
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
enumerated_modules_ = list;
BrowserThread::PostTask(
@@ -526,14 +524,21 @@ void ModuleEnumerator::PreparePathMappings() {
void ModuleEnumerator::CollapsePath(Module* entry) {
// Take the path and see if we can use any of the substitution values
// from the vector constructed above to replace c:\windows with, for
- // example, %systemroot%.
+ // example, %systemroot%. The most collapsed path (the one with the
+ // minimum length) wins.
+ size_t min_length = MAXINT;
+ string16 location = entry->location;
for (PathMapping::const_iterator mapping = path_mapping_.begin();
mapping != path_mapping_.end(); ++mapping) {
string16 prefix = mapping->first;
- if (StartsWith(entry->location, prefix, false)) {
- entry->location = mapping->second +
- entry->location.substr(prefix.length() - 1);
- return;
+ if (StartsWith(location, prefix, false)) {
+ string16 new_location = mapping->second +
+ location.substr(prefix.length() - 1);
+ size_t length = new_location.length() - mapping->second.length();
+ if (length < min_length) {
+ entry->location = new_location;
+ min_length = length;
+ }
}
}
}
diff --git a/chrome/browser/enumerate_modules_model_win.h b/chrome/browser/enumerate_modules_model_win.h
index a4479c4..1f524c8 100644
--- a/chrome/browser/enumerate_modules_model_win.h
+++ b/chrome/browser/enumerate_modules_model_win.h
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
+#include "base/gtest_prod_util.h"
#include "base/ref_counted.h"
#include "base/singleton.h"
#include "base/string16.h"
@@ -125,6 +126,8 @@ class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> {
void ScanNow(ModulesVector* list);
private:
+ FRIEND_TEST_ALL_PREFIXES(EnumerateModulesTest, CollapsePath);
+
// The (currently) hard coded blacklist of known bad modules.
static const BlacklistEntry kModuleBlacklist[];