summaryrefslogtreecommitdiffstats
path: root/base/security_unittest.cc
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-03 10:40:19 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-03 10:40:19 +0000
commit47db588a5dd854681a410c77c9c760635c0ca697 (patch)
treebc0a3a2bd8c106955b25fc11f2fa243db8e1cb73 /base/security_unittest.cc
parent7318e4b753e61ccdc8661503a4ba46b12afe3230 (diff)
downloadchromium_src-47db588a5dd854681a410c77c9c760635c0ca697.zip
chromium_src-47db588a5dd854681a410c77c9c760635c0ca697.tar.gz
chromium_src-47db588a5dd854681a410c77c9c760635c0ca697.tar.bz2
Revert 192031 "Base Security: fix-up overflow tests"
> Base Security: fix-up overflow tests > > - Re-enable NewOverflow on Windows for the most part > - Strengthen the compiler barrier on GCC compatible compilers > > BUG=174947 > > > Review URL: https://chromiumcodereview.appspot.com/13460015 http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%281%29/builds/17219/steps/base_unittests/logs/NewOverflow TBR=jln@chromium.org Review URL: https://codereview.chromium.org/13529002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/security_unittest.cc')
-rw-r--r--base/security_unittest.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/base/security_unittest.cc b/base/security_unittest.cc
index aa30f4f..2e865bc 100644
--- a/base/security_unittest.cc
+++ b/base/security_unittest.cc
@@ -34,11 +34,6 @@ namespace {
// as something we don't need (see the comment with calloc below).
template <typename Type>
Type HideValueFromCompiler(volatile Type value) {
-#if defined(__GNUC__)
- // In a GCC compatible compiler (GCC or Clang), make this compiler barrier
- // more robust than merely using "volatile".
- __asm__ volatile ("" : "+r" (value));
-#endif // __GNUC__
return value;
}
@@ -144,10 +139,10 @@ TEST(SecurityTest, TCMALLOC_TEST(MemoryAllocationRestrictionsNewArray)) {
// The tests bellow check for overflows in new[] and calloc().
-#if defined(OS_IOS)
- #define DISABLE_ON_IOS(function) DISABLED_##function
+#if defined(OS_IOS) || defined(OS_WIN)
+ #define DISABLE_ON_IOS_AND_WIN(function) DISABLED_##function
#else
- #define DISABLE_ON_IOS(function) function
+ #define DISABLE_ON_IOS_AND_WIN(function) function
#endif
#if defined(ADDRESS_SANITIZER)
@@ -174,9 +169,13 @@ void OverflowTestsSoftExpectTrue(bool overflow_detected) {
}
}
+// TODO(jln): crbug.com/174947 This can't even compile on Win64.
+#if !(defined(OS_WIN) && defined(ARCH_CPU_X86_64))
+
// Test array[TooBig][X] and array[X][TooBig] allocations for int overflows.
// IOS doesn't honor nothrow, so disable the test there.
-TEST(SecurityTest, DISABLE_ON_IOS(NewOverflow)) {
+// Disable on Windows, we suspect some are failing because of it.
+TEST(SecurityTest, DISABLE_ON_IOS_AND_WIN(NewOverflow)) {
const size_t kArraySize = 4096;
// We want something "dynamic" here, so that the compiler doesn't
// immediately reject crazy arrays.
@@ -192,16 +191,13 @@ TEST(SecurityTest, DISABLE_ON_IOS(NewOverflow)) {
char[kDynamicArraySize2][kArraySize]);
OverflowTestsSoftExpectTrue(!array_pointer);
}
- // On windows, the compiler prevents static array sizes of more than
- // 0x7fffffff (error C2148).
-#if !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS)
{
scoped_ptr<char[][kArraySize2]> array_pointer(new (nothrow)
char[kDynamicArraySize][kArraySize2]);
OverflowTestsSoftExpectTrue(!array_pointer);
}
-#endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS)
}
+#endif
// Call calloc(), eventually free the memory and return whether or not
// calloc() did succeed.