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

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: sync 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') | no next file with comments »
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 a34393c6f30dd41cf650d729f97f9dd9cf069702..51a61fadb47bea79c3445fe6fb0fc9b0f35071fa 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -5894,15 +5894,21 @@ void TestingAutomationProvider::RefreshPolicies(
#endif
}
-static int AccessArray(const int arr[], int index) {
- return arr[index];
+static int AccessArray(const volatile int arr[], const volatile 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[3] = {0, 0, 0};
+
+ // Send the reply while we can.
AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+
+ // Cause Address Sanitizer to abort this process.
+ volatile int index = 5;
+ AccessArray(testarray, &index);
}
void TestingAutomationProvider::GetIndicesFromTab(
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698