`RULE-10-1-1`: Array access not considered non-const use of non-const pointer

Open
#1,159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp
Domain
devtools

Research direction

Start by locating the implementation and tests for RULE-10-1-1, then reproduce the C++ example with array access on the pointer. Trace how the rule classifies the indexed expression; done means the affected cases are handled as intended and the relevant rule tests pass.

Written by the indexing model from the issue text.

Description

Difficulty-Medium false positive/false negative Stardard-MISRA-C++
Affected rules
  • RULE-10-1-1
Description

This is occurring in a new PR in qlx.

Example
        void f(vector<Type> *param, ...) {
            ....
                g(param[write_col].data() + write_begin, ...);
            }
        }

Once we index into param, it will be hard to analyze all such cases, but we should do what we can and exclude results otherwise.

Dominant language
CodeQL
Stars
227
Forks
82
Avg merge
6d 7h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-coding-standards

All issues in github/codeql-coding-standards

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.