mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 18:09:48 +00:00
Coverity finding CID 147829 Bad bit shift operation (BAD_SHIFT)
I'm fairly certian this is a false positive. Checking GF2NT::MultiplicativeInverse under code coverage shows its exercised 555,735 times. We will clear it anayway to squash the finding For those not aware, on Linux and Unix, you can issue 'make coverage' and get code coverage statistics
This commit is contained in:
parent
c3e45b2e51
commit
8d227675a9
5
gf2n.cpp
5
gf2n.cpp
@ -717,8 +717,11 @@ const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const
|
||||
for (unsigned int j=0; j<WORD_BITS-t1; j++)
|
||||
{
|
||||
// Coverity finding on shift amount of 'word x << (t1+j)'.
|
||||
// temp ^= ((temp >> j) & 1) << (t1 + j);
|
||||
|
||||
CRYPTOPP_ASSERT(t1+j < WORD_BITS);
|
||||
temp ^= ((temp >> j) & 1) << (t1 + j);
|
||||
const unsigned int shift = t1 + j;
|
||||
temp ^= ((shift >= WORD_BITS) ? 0 : ((temp >> j) & 1) << shift);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user