| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 protected: | 33 protected: |
| 34 scoped_ptr<base::Environment> env_; | 34 scoped_ptr<base::Environment> env_; |
| 35 bool had_asan_options_; | 35 bool had_asan_options_; |
| 36 std::string old_asan_options_; | 36 std::string old_asan_options_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 SBOX_TESTS_COMMAND int AddressSanitizerTests_Report(int argc, wchar_t** argv) { | 39 SBOX_TESTS_COMMAND int AddressSanitizerTests_Report(int argc, wchar_t** argv) { |
| 40 // AddressSanitizer should detect an out of bounds write (heap buffer | 40 // AddressSanitizer should detect an out of bounds write (heap buffer |
| 41 // overflow) in this code. | 41 // overflow) in this code. |
| 42 volatile int idx = 42; | 42 volatile int idx = 42; |
| 43 int *blah = new int[42]; | 43 int *volatile blah = new int[42]; |
| 44 blah[idx] = 42; | 44 blah[idx] = 42; |
| 45 delete [] blah; | 45 delete [] blah; |
| 46 return SBOX_TEST_FAILED; | 46 return SBOX_TEST_FAILED; |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST_F(AddressSanitizerTests, TestAddressSanitizer) { | 49 TEST_F(AddressSanitizerTests, TestAddressSanitizer) { |
| 50 // This test is only supposed to work when using AddressSanitizer. | 50 // This test is only supposed to work when using AddressSanitizer. |
| 51 // However, ASan/Win is not on the CQ yet, so compiler breakages may get into | 51 // However, ASan/Win is not on the CQ yet, so compiler breakages may get into |
| 52 // the code unnoticed. To avoid that, we compile this test in all Windows | 52 // the code unnoticed. To avoid that, we compile this test in all Windows |
| 53 // builds, but only run the AddressSanitizer-specific part of the test when | 53 // builds, but only run the AddressSanitizer-specific part of the test when |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 << "The stack trace doesn't have a correct filename:\n" << data; | 98 << "The stack trace doesn't have a correct filename:\n" << data; |
| 99 } else { | 99 } else { |
| 100 LOG(WARNING) << "Pre-Vista versions are not supported."; | 100 LOG(WARNING) << "Pre-Vista versions are not supported."; |
| 101 } | 101 } |
| 102 } else { | 102 } else { |
| 103 LOG(WARNING) << "Not an AddressSanitizer build, skipping the run."; | 103 LOG(WARNING) << "Not an AddressSanitizer build, skipping the run."; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 } | 107 } |
| OLD | NEW |