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( |