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

A15-4-4: Functions that allocate are considered non-throwing #662

Open
gg-sr opened this issue Aug 13, 2024 · 1 comment
Open

A15-4-4: Functions that allocate are considered non-throwing #662

gg-sr opened this issue Aug 13, 2024 · 1 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 Standard-AUTOSAR user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@gg-sr
Copy link

gg-sr commented Aug 13, 2024

Affected rules

  • A15-4-4

Description

A15-4-4/MissingNoExcept.ql flags functions which are not noexcept when no exception is explicitly thrown by them (or the functions they call). Unfortunately, this doesn't take into a account the fact that std::bad_alloc can be implicitly thrown by functions which allocate.

Example

void AppendTo(std::string& string) {
  // rules/A15-4-4/MissingNoExcept.bqrs:
  //   Function AppendTo could be declared noexcept(true).
  static_cast<void>(string.append("foo"));
}
@gg-sr gg-sr added the false positive/false negative An issue related to observed false positives or false negatives. label Aug 13, 2024
@lcartey lcartey added the user-report Issue reported by an end user of CodeQL Coding Standards label Oct 15, 2024
@lcartey lcartey added Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address Impact-Medium labels Oct 22, 2024
@lcartey lcartey moved this from Reported to Triaged in Coding Standards Public Development Board Oct 23, 2024
@lcartey
Copy link
Collaborator

lcartey commented Oct 23, 2024

Thanks for the report! This requires expanding our modelling of the exception behaviour of standard library functions, and deciding on default behaviour for different queries (ideally this one would over approximate the exceptions thrown, vs. the rules that look for missing annotations, which we may under approximate).

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 Standard-AUTOSAR user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

No branches or pull requests

3 participants