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

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10417031: Fix TestingAutomationProvider::SimulateAsanMemoryBug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more comments Created 8 years, 7 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 | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | chrome/test/pyautolib/pyauto.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/testing_automation_provider.cc
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index d1d0a40f35399f63d268214915791577a7674c58..0d911f73b8675a67559c755ed336b825b1ca8945 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -5885,15 +5885,20 @@ void TestingAutomationProvider::RefreshPolicies(
#endif
}
-static int AccessArray(const int arr[], int index) {
+static int AccessArray(const volatile int arr[], int index) {
return arr[index];
}
void TestingAutomationProvider::SimulateAsanMemoryBug(
base::DictionaryValue* args, IPC::Message* reply_message) {
- int testarray[41];
- AccessArray(testarray, 42);
+ // This array is volatile not to let compiler optimize us out.
+ volatile int testarray[41];
+
+ // Send the reply while we can.
AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+
+ // Cause Address Sanitizer to abort this process.
+ AccessArray(testarray, 42);
}
void TestingAutomationProvider::GetIndicesFromTab(
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | chrome/test/pyautolib/pyauto.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698