Clear coverity finding FORWARD_NULL (CID 147865)

pull/242/merge
Jeffrey Walton 2017-05-20 02:37:51 -04:00
parent 1abb5c36bd
commit 1427f5ecf9
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 5 additions and 4 deletions

View File

@ -171,18 +171,19 @@ size_t BlockTransformation::AdvancedProcessBlocks(const byte *inBlocks, const by
outIncrement = 0-outIncrement; outIncrement = 0-outIncrement;
} }
// Coverity finding.
bool xorFlag = xorBlocks && (flags & BT_XorInput);
while (length >= blockSize) while (length >= blockSize)
{ {
if (flags & BT_XorInput) if (xorFlag)
{ {
// Coverity finding. However, xorBlocks is never NULL if BT_XorInput. // xorBlocks non-NULL and with BT_XorInput.
CRYPTOPP_ASSERT(xorBlocks);
xorbuf(outBlocks, xorBlocks, inBlocks, blockSize); xorbuf(outBlocks, xorBlocks, inBlocks, blockSize);
ProcessBlock(outBlocks); ProcessBlock(outBlocks);
} }
else else
{ {
// xorBlocks can be NULL. See, for example, ECB_OneWay::ProcessData. // xorBlocks may be non-NULL and without BT_XorInput.
ProcessAndXorBlock(inBlocks, xorBlocks, outBlocks); ProcessAndXorBlock(inBlocks, xorBlocks, outBlocks);
} }