From e7974c7915c90815cc00fa3500e0815ff693169f Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 3 Sep 2017 11:17:57 -0400 Subject: [PATCH] Fix unaligned data in self test AltiVec and Power8 are brutal. The SIMD units just mask-off the lower 3 address bits. They make the buffer aligned whethere it is aligned or not --- validat0.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/validat0.cpp b/validat0.cpp index 6ee466bd..43ac4f06 100644 --- a/validat0.cpp +++ b/validat0.cpp @@ -2467,16 +2467,16 @@ bool TestHuffmanCodes() { try { - byte data1[0xfff]; // Place on stack, avoid new - unsigned int data2[0xff]; + SecByteBlock data1(0xfff); + SecBlock data2(0xff); unsigned int len1 = GlobalRNG().GenerateWord32(4, 0xfff); - GlobalRNG().GenerateBlock(data1, len1); + GlobalRNG().GenerateBlock(data1.BytePtr(), data1.SizeInBytes()); unsigned int len2 = GlobalRNG().GenerateWord32(4, 0xff); - GlobalRNG().GenerateBlock((byte*)data2, len2*sizeof(unsigned int)); + GlobalRNG().GenerateBlock(data2.BytePtr(), data2.SizeInBytes()); - ArraySource source(data1, len1, false); - HuffmanDecoder decoder(data2, len2); + ArraySource source(data1.BytePtr(), data1.SizeInBytes(), false); + HuffmanDecoder decoder(data2.begin(), data2.size()); LowFirstBitReader reader(source); unsigned int val;