`ReadOfUninitializedMemory`: Improve overall precision and recall

Aperta
#1,079 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
devtools

Direzione di ricerca

Inizia con la query ReadOfUninitializedMemory e confronta l’implementazione attuale con il lavoro presente nel branch referenziato try-use-subobjects-lib-in-rule-11-6-2. Esamina gli esempi di unit test per il falso positivo e il falso negativo segnalati, quindi determina se la query migliorata aumenta precisione e recall risolvendo al contempo le decisioni rimanenti sull’inizializzazione di campi e array.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
CodeQL
Stelle
227
Fork
82
Merge medio
6g 7h
PR unite (30g)
9

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/codeql-coding-standards

Tutte le issue di github/codeql-coding-standards

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.