`A27-0-4`: C-Style (and arrays) detected when logging in assert or using the hash/stringize operator in a macro
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the implementations of rules A27-0-4 and A18-1-1, then reproduce the supplied C++ example. Compare the diagnostics for the macro, assert call, and stringized expression with cases that directly use arrays or strings. Done means the reported false positives are resolved while the affected rules still detect their intended cases.
Written by the indexing model from the issue text.
Description
Affected rules
A27-0-4A18-1-1
Description
Alerts of both rules are triggered even if no C-style array or string is directly used. It may also be relevant that the usage of the # operator is covered by rule M16-3-2.
Example
#include <cassert>
#define ASSERT(expr) ((expr) ? static_cast<void>(0) : [] { assert(false && #expr); }())
class a_class
{
public:
void some_operator()
{
ASSERT(flag_);
}
private:
bool flag_ = false;
};
int main()
{
assert((false) && "A way to add an assert message");
a_class instance;
instance.some_operator();
}
A27-0-4 and A18-1-1 alerts are signaled on ASSERT(flag_); as well as assert((false) && "A way ... message");
- Dominant language
- CodeQL
- Stars
- 227
- Forks
- 82
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Difficulty 4/5 3-5 days Newbie friendliness 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Openfalse positive/false negative
Difficulty 4/5 3-5 days Newbie friendliness 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Difficulty 3/5 1-2 days Newbie friendliness 65/100
github/codeql-coding-standards#1175 ·
All issues in github/codeql-coding-standards
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ScoopInstaller/Nonportable#639 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ScoopInstaller/Extras#18800 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
uqbar-project/website-wollok-ts#84 · 2 comments ·
-
on hold T: core-bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100