Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added TrustInSoft Analyzer to the Automated Detection table.

...

Tool

Version

Checker

Description

Astrée
Include Page
Astrée_V
Astrée_V

precision-shift-width
precision-shift-width-constant

Fully checked
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC-INT34Can detect shifts by a negative or an excessive number of bits and right shifts on negative values.
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

LANG.ARITH.BIGSHIFT
LANG.ARITH.NEGSHIFT

Shift amount exceeds bit width
Negative shift amount

Compass/ROSE



Can detect violations of this rule. Unsigned operands are detected when checking for INT13-C. Use bitwise operators only on unsigned operands

Coverity
Include Page
Coverity_V
Coverity_V

BAD_SHIFT

Implemented
Cppcheck
Include Page
Cppcheck_V
Cppcheck_V
shiftNegative, shiftTooManyBits

Context sensitive analysis
Warns whenever Cppcheck sees a negative shift for a POD expression
(The warning for shifting too many bits is written only if Cppcheck has sufficient type information and you use --platform to specify the sizes of the standard types.)

ECLAIR
Include Page
ECLAIR_V
ECLAIR_V
CC2.INT34Partially implemented
LDRA tool suite
Include Page
LDRA_V
LDRA_V

51 S, 403 S, 479 S

Partially implemented

Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V
CERT_C-INT34-a

Invalid range of the right hand operand of a shift operator

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

Shift of a negative value

Shift operation overflow

Shift operator on negative value

Overflow from shifting operation

PRQA QA-C
Include Page
PRQA QA-C_v
PRQA QA-C_v

0499, 2790 [C], 2791 [D],
2792 [A], 2793 [S]

Partially implemented
PRQA QA-C++

Include Page
cplusplus:PRQA QA-C++_V
cplusplus:PRQA QA-C++_V

2791, 2792, 2793, 3003, 3321, 3322
PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V610
RuleChecker

Include Page
RuleChecker_V
RuleChecker_V

precision-shift-width-constant

Partially checked
TrustInSoft Analyzer

Include Page
TrustInSoft Analyzer_V
TrustInSoft Analyzer_V

shift

Exhaustively verified (see one compliant and one non-compliant example).

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...