diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-08-15 03:11:03 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-08-15 03:11:03 -0400 |
commit | 659b47108ac42698722aefcd58ba38ace07acc06 (patch) | |
tree | 770f5e02d8072c02277ecd87e741e29adf6ef639 /validat0.cpp | |
parent | 0110f8397f699998022462d081456965edcc18e0 (diff) | |
download | cryptopp-git-659b47108ac42698722aefcd58ba38ace07acc06.tar.gz |
Fix Address Sanitizer findings on GCC117
GCC117 is a Aarch64/ARM64 server with AMD's ARM chip and GCC 7.10. It looks like GCC is performing some std::string optimizations that generates a finding. We did not witness the finding on other platforms, like other Aarch64 devices and x86_64.
We will need to check if taking the address of element-0 is still approved way to get the non-const pointer to the elements
Diffstat (limited to 'validat0.cpp')
-rw-r--r-- | validat0.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/validat0.cpp b/validat0.cpp index 772e4414..6ee466bd 100644 --- a/validat0.cpp +++ b/validat0.cpp @@ -242,13 +242,13 @@ bool TestCompressors() // Unzip random data. See if we can induce a crash
for (unsigned int i = 0; i<128; i++)
{
- SecByteBlock src;
+ SecByteBlock src;
unsigned int len = GlobalRNG().GenerateWord32(4, 0xfff);
- src.resize(len);
+ src.resize(len);
RandomNumberSource(GlobalRNG(), len, true, new ArraySink(src, src.size()));
src[0] = (byte)0x1f; // magic header
- src[1] = (byte)0x8b;
+ src[1] = (byte)0x8b;
src[2] = 0x00; // extra flags
src[3] = src[3] & (2 | 4 | 8 | 16 | 32); // flags
@@ -313,13 +313,13 @@ bool TestCompressors() // Inflate random data. See if we can induce a crash
for (unsigned int i = 0; i<128; i++)
{
- SecByteBlock src;
+ SecByteBlock src;
unsigned int len = GlobalRNG().GenerateWord32(4, 0xfff);
- src.resize(len);
+ src.resize(len);
RandomNumberSource(GlobalRNG(), len, true, new ArraySink(src, src.size()));
src[0] = (byte)0x1f; // magic header
- src[1] = (byte)0x8b;
+ src[1] = (byte)0x8b;
src[2] = 0x00; // extra flags
src[3] = src[3] & (2 | 4 | 8 | 16 | 32); // flags
@@ -392,9 +392,9 @@ bool TestCompressors() // Decompress random data. See if we can induce a crash
for (unsigned int i = 0; i<128; i++)
{
- SecByteBlock src;
+ SecByteBlock src;
unsigned int len = GlobalRNG().GenerateWord32(4, 0xfff);
- src.resize(len);
+ src.resize(len);
RandomNumberSource(GlobalRNG(), len, true, new ArraySink(src, src.size()));
// CMF byte
@@ -536,7 +536,7 @@ bool TestEncryptors() StringSource(src, true, new LegacyEncryptor(pwd.c_str(),new StringSink(dest)));
StringSource(dest, true, new LegacyDecryptor(pwd.c_str(),new StringSink(rec)));
-
+
if (src != rec)
throw Exception(Exception::OTHER_ERROR, "LegacyEncryptor failed a self test");
}
|