Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RULE-21-15: Improve detection of compatible types #573

Open
lcartey opened this issue Apr 25, 2024 · 0 comments
Open

RULE-21-15: Improve detection of compatible types #573

lcartey opened this issue Apr 25, 2024 · 0 comments
Assignees
Labels
Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium

Comments

@lcartey
Copy link
Collaborator

lcartey commented Apr 25, 2024

Affected rules

  • RULE-21-15

Description

The query for this rule is currently too strict - it requires the types be identical (after stripping specifiers), instead of compatible. For example, it does not allow a combination of pointers and arrays, or array types with different sizes, or types which are compatible but not identical (e.g. signed int and int.

Example

void example_function(int i1[80], int *i2, int i3[10], signed int *i4) {
  memcpy(i1,i2,1); // COMPLIANT[FALSE_POSITIVE]
  memcpy(i1,i3,1); // COMPLIANT[FALSE_POSITIVE]
  memcpy(i2,i3,1); // COMPLIANT[FALSE_POSITIVE]
  memcpy(i2,i4,1); // COMPLIANT[FALSE_POSITIVE]
}
@lcartey lcartey added Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium labels Apr 25, 2024
@lcartey lcartey self-assigned this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium
Projects
Development

No branches or pull requests

1 participant