Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`RULE-18-1`: Picky about how pointers are tracked, doesn't consider derefs before 1 from end, or array-to-pointer conversions

Open
#840 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
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
devtools

Research direction

Locate the query implementations for RULE-18-1 and M5-0-16, then compare how they track pointer creation, array-to-pointer conversions, direct address expressions, and one-past-the-end accesses. Done means the examples distinguish valid one-past pointers from invalid dereferences or indexing and report each non-compliant case without the listed false negatives.

Written by the indexing model from the issue text.

Description

Difficulty-Medium false positive/false negative false-negative Impact-Medium Standard-AUTOSAR Standard-MISRA-C
Affected rules
  • RULE-18-1
  • M5-0-16
Description

The query expects that as pointers are made they are assigned to variables, and assumes that pointers into arrays always use ArrayExpr (eg x[y]). It also allows dereferencing or indexing past 1 of an array -- its OK to make a pointer to 1 past the array, but dereferencing is not defined.

Example
void example_function() {
  int x[10];

  int *p1 = &x[12]; // NON_COMPLIANT
  f(p1);

  int *p2 = x + 12; // NON_COMPLIANT[FALSE_NEGATIVE]

  f(&x[12]); // NON_COMPLIANT[FALSE_NEGATIVE]

  int *p3 = &x[10]; // COMPLIANT
  *p3; // NON_COMPLIANT[FALSE_NEGATIVE]
  x[10]; // NON_COMPLIANT[FALSE_NEGATIVE] - at least for MISRA-C
}
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.