mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 01:49:41 +00:00
Fix UBsan overflow finding
We were cating UBsan findings under Clang similar to "adv-simd.h:1138:26: runtime error: addition of unsigned offset to 0x000002d41410 overflowed to 0x000002d41400". The problem was CRYPTOPP_CONSTANT, which used an enum. The compiler is allowed to pick the underlying data type, and Clang was picking a signed type
This commit is contained in:
parent
c3a85caf52
commit
dc21de2483
24
adv-simd.h
24
adv-simd.h
@ -88,8 +88,8 @@ inline size_t AdvancedProcessBlocks64_NEON2x6(F2 func2, F6 func6,
|
||||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length >= 8);
|
||||
|
||||
CRYPTOPP_CONSTANT(blockSize = 8)
|
||||
CRYPTOPP_CONSTANT(neonBlockSize = 16)
|
||||
const size_t blockSize = 8;
|
||||
const size_t neonBlockSize = 16;
|
||||
|
||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : neonBlockSize;
|
||||
size_t xorIncrement = xorBlocks ? neonBlockSize : 0;
|
||||
@ -316,8 +316,8 @@ size_t AdvancedProcessBlocks128_NEON1x6(F1 func1, F6 func6,
|
||||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length >= 16);
|
||||
|
||||
CRYPTOPP_CONSTANT(blockSize = 16)
|
||||
// CRYPTOPP_CONSTANT(neonBlockSize = 16)
|
||||
const size_t blockSize = 16;
|
||||
// const size_t neonBlockSize = 16;
|
||||
|
||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
||||
size_t xorIncrement = xorBlocks ? blockSize : 0;
|
||||
@ -455,8 +455,8 @@ size_t AdvancedProcessBlocks128_NEON2x6(F2 func2, F6 func6,
|
||||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length >= 16);
|
||||
|
||||
CRYPTOPP_CONSTANT(blockSize = 16)
|
||||
// CRYPTOPP_CONSTANT(neonBlockSize = 16)
|
||||
const size_t blockSize = 16;
|
||||
// const size_t neonBlockSize = 16;
|
||||
|
||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
||||
size_t xorIncrement = xorBlocks ? blockSize : 0;
|
||||
@ -682,8 +682,8 @@ inline size_t AdvancedProcessBlocks64_SSE2x6(F2 func2, F6 func6,
|
||||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length >= 8);
|
||||
|
||||
CRYPTOPP_CONSTANT(blockSize = 8)
|
||||
CRYPTOPP_CONSTANT(xmmBlockSize = 16)
|
||||
const size_t blockSize = 8;
|
||||
const size_t xmmBlockSize = 16;
|
||||
|
||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : xmmBlockSize;
|
||||
size_t xorIncrement = xorBlocks ? xmmBlockSize : 0;
|
||||
@ -916,8 +916,8 @@ inline size_t AdvancedProcessBlocks128_SSE2x6(F2 func2, F6 func6,
|
||||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length >= 16);
|
||||
|
||||
CRYPTOPP_CONSTANT(blockSize = 16)
|
||||
// CRYPTOPP_CONSTANT(xmmBlockSize = 16)
|
||||
const size_t blockSize = 16;
|
||||
// const size_t xmmBlockSize = 16;
|
||||
|
||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
||||
size_t xorIncrement = xorBlocks ? blockSize : 0;
|
||||
@ -1101,8 +1101,8 @@ inline size_t AdvancedProcessBlocks128_SSE1x4(F1 func1, F4 func4,
|
||||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length >= 16);
|
||||
|
||||
CRYPTOPP_CONSTANT(blockSize = 16)
|
||||
// CRYPTOPP_CONSTANT(xmmBlockSize = 16)
|
||||
const size_t blockSize = 16;
|
||||
// const size_t xmmBlockSize = 16;
|
||||
|
||||
size_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
||||
size_t xorIncrement = xorBlocks ? blockSize : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user