Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0b6043

Browse files
committed
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.
1 parent2c0455e commite0b6043

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎scrypt.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ void Scrypt::ValidateParameters(size_t derivedLen, word64 cost, word64 blockSize
190190
CRYPTOPP_ASSERT(blockSize !=0);
191191
CRYPTOPP_ASSERT(parallelization !=0);
192192

193+
if (cost ==0)
194+
throwInvalidArgument("Scrypt: cost cannot be 0");
195+
196+
if (blockSize ==0)
197+
throwInvalidArgument("Scrypt: block size cannot be 0");
198+
199+
if (parallelization ==0)
200+
throwInvalidArgument("Scrypt: parallelization cannot be 0");
201+
193202
// Optimizer should remove this on 32-bit platforms
194203
if (std::numeric_limits<size_t>::max() > std::numeric_limits<word32>::max())
195204
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp