Skip to content

A4-7-1: Identify guards for shift operations #396

Closed

Description

@lcartey

Affected rules

  • A4-7-1

Description

The IntegerExpressionLeadToDataLoss.ql query does not detect/identify guards for shift operations.

We already implement appropriate guards in the C rule INT34-C, and we should consider combining the implementations.

Example

std::size_t pow2(std::size_t i) {
  if (i < (sizeof(std::size_t) * CHAR_BIT)) {
     constexpr std::size_t one{1};
     return one << i; // COMPLIANT
  }
}

Activity

  1. added
    Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to address
    false positive/false negativeAn issue related to observed false positives or false negatives.
    user-reportIssue reported by an end user of CodeQL Coding Standards
    on Oct 5, 2023
  2. self-assigned this
    on Feb 8, 2024
  3. moved this from Scheduled to In Progress in Coding Standards Public Development Boardon Feb 22, 2024
  4. moved this from In Progress to Ready for review in Coding Standards Public Development Boardon Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to addressImpact-Mediumfalse positive/false negativeAn issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding Standards

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions