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

Unified Diff: components/crash/content/app/breakpad_linux.cc

Issue 2717223003: Add WebView-specific whitelist for crash keys. (Closed)
Patch Set: Naming webview whitelist array. Created 3 years, 10 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 | « components/crash/content/app/breakpad_linux.h ('k') | components/crash/content/app/crash_reporter_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/crash/content/app/breakpad_linux.cc
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc
index 3c31d7619e49bf56210ff310e3a73905c58a43ec..722ce16dca64e6e8b72e67c5279f865751db58db 100644
--- a/components/crash/content/app/breakpad_linux.cc
+++ b/components/crash/content/app/breakpad_linux.cc
@@ -101,6 +101,9 @@ ExceptionHandler* g_breakpad = nullptr;
const char* g_asan_report_str = nullptr;
#endif
+bool g_use_crash_key_white_list = false;
+const char* const* g_crash_key_white_list = nullptr;
+
#if defined(OS_ANDROID)
#define G_DUMPS_SUPPRESSED_MAGIC 0x5AFECEDE
uint32_t g_dumps_suppressed = 0;
@@ -1098,9 +1101,21 @@ void EnableNonBrowserCrashDumping() {
}
#endif // defined(OS_ANDROID)
+bool IsInWhiteList(const base::StringPiece& key) {
+ DCHECK(g_crash_key_white_list);
+ for (size_t i = 0; g_crash_key_white_list[i]; ++i) {
+ if (0 == my_strcmp(g_crash_key_white_list[i], key.data())) {
+ return true;
+ }
+ }
+ return false;
+}
+
void SetCrashKeyValue(const base::StringPiece& key,
const base::StringPiece& value) {
- g_crash_keys->SetKeyValue(key.data(), value.data());
+ if (!g_use_crash_key_white_list || IsInWhiteList(key)) {
+ g_crash_keys->SetKeyValue(key.data(), value.data());
+ }
}
void ClearCrashKey(const base::StringPiece& key) {
@@ -1112,6 +1127,9 @@ void ClearCrashKey(const base::StringPiece& key) {
void InitCrashKeys() {
g_crash_keys = new CrashKeyStorage;
GetCrashReporterClient()->RegisterCrashKeys();
+ g_use_crash_key_white_list =
+ GetCrashReporterClient()->UseCrashKeysWhiteList();
+ g_crash_key_white_list = GetCrashReporterClient()->GetCrashKeyWhiteList();
base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValue, &ClearCrashKey);
}
@@ -1905,6 +1923,10 @@ void InitCrashReporter(const std::string& process_type) {
InitCrashReporter(process_type, sanitization_info);
}
+void InitCrashKeysForTesting() {
+ InitCrashKeys();
+}
+
void InitCrashReporter(const std::string& process_type,
const SanitizationInfo& sanitization_info) {
#else
« no previous file with comments | « components/crash/content/app/breakpad_linux.h ('k') | components/crash/content/app/crash_reporter_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698