Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
INT34-C | Low | Unlikely | Medium | P2 | L3 |
Tool | Version | Checker | Description |
---|---|---|---|
Astrée | 22.04 | precision-shift-width precision-shift-width-constant | Fully checked |
Axivion Bauhaus Suite | 7.2.0 | CertC-INT34 | Can detect shifts by a negative or an excessive number of bits and right shifts on negative values. |
CodeSonar | 7.2p0 | 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 | 2017.07 | BAD_SHIFT | Implemented |
Cppcheck | 1.66 | 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 | 1.2 | CC2.INT34 | Partially implemented |
Helix QAC | 2022.4 | C0499, C2790, C++2790, C++3003 DF2791, DF2792, DF2793 | |
Klocwork | 2022.4 | MISRA.SHIFT.RANGE.2012 | |
LDRA tool suite | 9.7.1 | 51 S, 403 S, 479 S | Partially implemented |
Parasoft C/C++test | 2022.2 | CERT_C-INT34-a | Avoid incorrect shift operations |
Polyspace Bug Finder | R2022b | CERT C: Rule INT34-C | Checks for: Shift of a negative valuehift of a negative value, shift operation overflowhift operation overflow. Rule partially covered. |
PRQA QA-C | 9.7 | 0499, 2790 \[C\], 2791 \[D\], 2792 \[A\], 2793 \[S\] | Partially implemented |
PRQA QA-C++ | 4.4 | 2791, 2792, 2793, 3003, 3321, 3322 | |
PVS-Studio | 7.23 | V610 | |
RuleChecker | 22.04 | precision-shift-width-constant | Partially checked |
TrustInSoft Analyzer | 1.38 | shift | Exhaustively verified (see one compliant and one non-compliant example ). |
Taxonomy | Taxonomy item | Relationship |
---|---|---|
CERT C | INT13-C. Use bitwise operators only on unsigned operands | Prior to 2018-01-12: CERT: Unspecified Relationship |
CERT C | INT35-C. Use correct integer precisions | Prior to 2018-01-12: CERT: Unspecified Relationship |
CERT C | INT32-C. Ensure that operations on signed integers do not result in overflow | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TR 24772:2013 | Arithmetic Wrap-Around Error \[FIF\] | Prior to 2018-01-12: CERT: Unspecified Relationship |
CWE 2.11 | CWE-682 | 2017-07-07: CERT: Rule subset of CWE |
CWE 2.11 | CWE-758 | 2017-07-07: CERT: Rule subset of CWE |
\[ C99 Rationale 2003 \] | 6.5.7, "Bitwise Shift Operators" |
\[ Dowd 2006 \] | Chapter 6, "C Language Issues" |
\[ Seacord 2013b \] | Chapter 5, "Integer Security" |
\[ Viega 2005 \] | Section 5.2.7, "Integer Overflow" |
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
INT36-C | Low | Probable | High | P2 | L3 |
Tool | Version | Checker | Description |
---|---|---|---|
Astrée | 22.04 | pointer-integral-cast pointer-integral-cast-implicit function-pointer-integer-cast function-pointer-integer-cast-implicit | Fully checked |
Axivion Bauhaus Suite | 7.2.0 | CertC-INT36 | Fully implemented |
Clang | 3.9 | -Wint-to-pointer-cast , -Wint-conversion | Can detect some instances of this rule, but does not detect all |
CodeSonar | 7.2p0 | LANG.CAST.PC.CONST2PTRLANG.CAST.PC.INT | Conversion: integer constant to pointer Conversion: pointer/integer |
Compass/ROSE | |||
Coverity | 2017.07 | PW.POINTER_CONVERSION_LOSES_BITS | Fully implemented |
Helix QAC | 2022.4 | C0303, C0305, C0306, C0309, C0324, C0326, C0360, C0361, C0362 C++3040, C++3041, C++3042, C++3043, C++3044, C++3045, C++3046, C++3047, C++3048 | |
Klocwork | 2022.4 | MISRA.CAST.OBJ_PTR_TO_INT.2012 | |
LDRA tool suite | 9.7.1 | 439 S, 440 S | Fully implemented |
Parasoft C/C++test | 2022.2 | CERT_C-INT36-b | A conversion should not be performed between a pointer to object type and an integer type other than 'uintptr_t' or 'intptr_t' |
PC-lint Plus | 1.4 | 4287 | Partially supported: reports casts from pointer types to smaller integer types which lose information |
Polyspace Bug Finder | R2022b | CERT C: Rule INT36-C | Checks for unsafe conversion between pointer and integer (rule partially covered) |
PRQA QA-C | 9.7 | 0303, 0305, 0306, 0309, 0324, 0326, 0360, 0361, 0362 | Partially implemented |
PRQA QA-C++ | 4.4 | 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048 | |
PVS-Studio | 7.23 | V527 , V528 , V542 , V566 , V601 , V647 , V1091 | |
RuleChecker | 22.04 | pointer-integral-cast pointer-integral-cast-implicit function-pointer-integer-cast function-pointer-integer-cast-implicit | Fully checked |
SonarQube C/C++ Plugin | 3.11 | S1767 | Partially implemented |
Taxonomy | Taxonomy item | Relationship |
---|---|---|
CERT C | INT11-CPP. Take care when converting from pointer to integer or integer to pointer | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TR 24772:2013 | Pointer Casting and Pointer Type Changes \[HFC\] | Prior to 2018-01-12: CERT: Unspecified Relationship |
ISO/IEC TS 17961:2013 | Converting a pointer to integer or integer to pointer \[intptrconv\] | Prior to 2018-01-12: CERT: Unspecified Relationship |
CWE 2.11 | CWE-587 , Assignment of a Fixed Address to a Pointer | 2017-07-07: CERT: Partial overlap |
CWE 2.11 | CWE-704 | 2017-06-14: CERT: Rule subset of CWE |
CWE 2.11 | CWE-758 | 2017-07-07: CERT: Rule subset of CWE |
CWE 3.1 | CWE-119 , Improper Restriction of Operations within the Bounds of a Memory Buffer | 2018-10-19:CERT:None |
CWE 3.1 | CWE-466 , Return of Pointer Value Outside of Expected Range | 2018-10-19:CERT:None |
\[ ISO/IEC 9899:2011 \] | 6.3.2.3, "Pointers" |