Clear coverity finding CHECKED_RETURN (CID 147833)

pull/242/merge
Jeffrey Walton 2017-05-20 01:42:20 -04:00
parent 555617d456
commit 25fcb7bef8
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 5 additions and 1 deletions

View File

@ -155,12 +155,16 @@ void PolynomialMod2::Encode(byte *output, size_t outputLen) const
void PolynomialMod2::Decode(BufferedTransformation &bt, size_t inputLen) void PolynomialMod2::Decode(BufferedTransformation &bt, size_t inputLen)
{ {
CRYPTOPP_ASSERT(bt.MaxRetrievable() >= inputLen);
if (bt.MaxRetrievable() < inputLen)
throw InvalidArgument("PolynomialMod2: input length is too small");
reg.CleanNew(BytesToWords(inputLen)); reg.CleanNew(BytesToWords(inputLen));
for (size_t i=inputLen; i > 0; i--) for (size_t i=inputLen; i > 0; i--)
{ {
byte b; byte b;
bt.Get(b); (void)bt.Get(b);
reg[(i-1)/WORD_SIZE] |= word(b) << ((i-1)%WORD_SIZE)*8; reg[(i-1)/WORD_SIZE] |= word(b) << ((i-1)%WORD_SIZE)*8;
} }
} }