`ReadOfUninitializedMemory`: Improve overall precision and recall

Ouverte
#1,079 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
25/100
Type d'issue
Refactorisation
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
cpp
Domaine
devtools

Piste de recherche

Commencez par la requête ReadOfUninitializedMemory et comparez l’implémentation actuelle avec le travail effectué sur la branche référencée try-use-subobjects-lib-in-rule-11-6-2. Examinez les exemples de tests unitaires correspondant au faux positif et au faux négatif signalés, puis déterminez si la requête améliorée augmente la précision et le rappel tout en résolvant les décisions restantes concernant l’initialisation des champs et des tableaux.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Difficulty-High false positive/false negative Impact-Medium
Affected rules
  • RULE-11-6-2
  • RULE-9-1
  • A8-5-0
  • EXP33-C
  • EXP53-CPP
Description

this query makes use of approximations that underrepresent uninitialized variables and over represent definition locations. it is in the idea of only reporting cases where results are more certain, however a potential audit version of the query could be constructed that improves the potential case detection and catch some FPs and FNs that are currently not detected.

work has been done on this effort in this branch.

this improved query has benefits of:

  • reuses more existing modelling
  • models allocated objects in a way that reuses more out of the box library as well
  • increases cases handled that involved subobjects (both potential field analysis and also array analysis)

the current improved query needs more effort on:

  • still uses some approximations around field initialization (see below comment for one such improvement/but still heurisitic)
  • determination on if array subobject cases should be included or not (see below comment as well for potential adjustment to align omission more with current version of query)
Example

one FP case within the unit test that will be improved is:

int *p1 = new int;
  *p1 = 0; // COMPLIANT[FALSE_POSITIVE] -- this is not found bc this is not an
           // lvalue access
  use(p1); // COMPLIANT[FALSE_POSITIVE] -- the pointee of p1 has been
           // initialized

these cases will no longer be found with the improved version of the query

one FN case within the unit test that will be improved is:

  S s1;
  S s2 = {1};

  auto i1 = s1.m1; // NON_COMPLIANT[FALSE_NEGATIVE] - rule currently is not
                   // field sensitive

this cases will be found with the improved version of the query

the examples given are run with the optional additions listed below in the comment

Langage dominant
CodeQL
Étoiles
227
Forks
82
Merge moyen
6 j 7 h
PR mergées (30 j)
9

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/codeql-coding-standards

Toutes les issues de github/codeql-coding-standards

Issues similaires

Plus d'issues DevTools

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.