diff options
author | snappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143> | 2012-02-11 22:11:22 +0000 |
---|---|---|
committer | snappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143> | 2012-02-11 22:11:22 +0000 |
commit | 249f25862a06904fc09ebea34b086378fecf5b0d (patch) | |
tree | 55fcbd25affc05f1333f1d5a8c62b0afbe03b5de /snappy_unittest.cc | |
parent | 68a4f76c4933ae06e4590b4f47b2d40dbe3ae019 (diff) | |
download | snappy-249f25862a06904fc09ebea34b086378fecf5b0d.tar.gz |
Lower the size allocated in the "corrupted input" unit test from 256 MB
to 2 MB. This fixes issues with running the unit test on platforms with
little RAM (e.g. some ARM boards).
Also, reactivate the 2 MB test for 64-bit platforms; there's no good
reason why it shouldn't be.
R=sanjay
git-svn-id: http://snappy.googlecode.com/svn/trunk@58 03e5f5b5-db94-4691-08a0-1a8bf15f6143
Diffstat (limited to 'snappy_unittest.cc')
-rw-r--r-- | snappy_unittest.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/snappy_unittest.cc b/snappy_unittest.cc index 0984e3e..f3b9c83 100644 --- a/snappy_unittest.cc +++ b/snappy_unittest.cc @@ -591,22 +591,24 @@ TYPED_TEST(CorruptedTest, VerifyCorrupted) { // Another security check; check a crazy big length can't DoS us with an // over-allocation. // Currently this is done only for 32-bit builds. On 64-bit builds, - // where 3GBytes might be an acceptable allocation size, Uncompress() + // where 3 GB might be an acceptable allocation size, Uncompress() // attempts to decompress, and sometimes causes the test to run out of // memory. dest[0] = dest[1] = dest[2] = dest[3] = 0xff; - // This decodes to a really large size, i.e., 3221225471 bytes + // This decodes to a really large size, i.e., about 3 GB. dest[4] = 'k'; CHECK(!IsValidCompressedBuffer(TypeParam(dest))); CHECK(!Uncompress(TypeParam(dest), &uncmp)); - dest[0] = dest[1] = dest[2] = 0xff; - dest[3] = 0x7f; - CHECK(!IsValidCompressedBuffer(TypeParam(dest))); - CHECK(!Uncompress(TypeParam(dest), &uncmp)); } else { LOG(WARNING) << "Crazy decompression lengths not checked on 64-bit build"; } + // This decodes to about 2 MB; much smaller, but should still fail. + dest[0] = dest[1] = dest[2] = 0xff; + dest[3] = 0x00; + CHECK(!IsValidCompressedBuffer(TypeParam(dest))); + CHECK(!Uncompress(TypeParam(dest), &uncmp)); + // try reading stuff in from a bad file. for (int i = 1; i <= 3; ++i) { string data = ReadTestDataFile(StringPrintf("baddata%d.snappy", i).c_str()); |