| 111 | } |
| 112 | |
| 113 | void CheckTypeImpl::tooBigBitwiseShiftError(const Token *tok, int lhsbits, const ValueFlow::Value &rhsbits) |
| 114 | { |
| 115 | constexpr char id[] = "shiftTooManyBits"; |
| 116 | |
| 117 | if (!tok) { |
| 118 | reportError(tok, Severity::error, id, "Shifting 32-bit value by 40 bits is undefined behaviour", CWE758, Certainty::normal); |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | ErrorPath errorPath = getErrorPath(tok, &rhsbits, "Shift"); |
| 123 | |
| 124 | std::ostringstream errmsg; |
| 125 | errmsg << "Shifting " << lhsbits << "-bit value by " << rhsbits.intvalue << " bits is undefined behaviour"; |
| 126 | if (rhsbits.condition) |
| 127 | errmsg << ". See condition at line " << rhsbits.condition->linenr() << "."; |
| 128 | |
| 129 | reportError(std::move(errorPath), rhsbits.errorSeverity() ? Severity::error : Severity::warning, id, errmsg.str(), CWE758, rhsbits.isInconclusive() ? Certainty::inconclusive : Certainty::normal); |
| 130 | } |
| 131 | |
| 132 | void CheckTypeImpl::tooBigSignedBitwiseShiftError(const Token *tok, int lhsbits, const ValueFlow::Value &rhsbits) |
| 133 | { |
no test coverage detected