mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Fix Scrypt crash when blockSize is 0 (GH #842)
This may change in the future. I prefer to recover, and use default block size when block size is 0. But this stops the immediate problem of a crash.
This commit is contained in:
parent
2c0455edf8
commit
e0b60439bf
@ -190,6 +190,15 @@ void Scrypt::ValidateParameters(size_t derivedLen, word64 cost, word64 blockSize
|
||||
CRYPTOPP_ASSERT(blockSize != 0);
|
||||
CRYPTOPP_ASSERT(parallelization != 0);
|
||||
|
||||
if (cost == 0)
|
||||
throw InvalidArgument("Scrypt: cost cannot be 0");
|
||||
|
||||
if (blockSize == 0)
|
||||
throw InvalidArgument("Scrypt: block size cannot be 0");
|
||||
|
||||
if (parallelization == 0)
|
||||
throw InvalidArgument("Scrypt: parallelization cannot be 0");
|
||||
|
||||
// Optimizer should remove this on 32-bit platforms
|
||||
if (std::numeric_limits<size_t>::max() > std::numeric_limits<word32>::max())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user