`MEM53-CPP`: False positive due to flow through `realloc`
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 30/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- cpp
- Domaine
- devtools, testing-qa
Piste de recherche
Commencez par les cas de test MEM53-CPP et la définition de isSource de la configuration de taint-tracking, puis examinez les pull requests associés concernant la modification du flux de realloc. Déterminez comment l’ancienne bibliothèque basée sur un AST gère realloc et si le scénario de test concerné est valide ; le travail est considéré comme terminé lorsque le faux positif est résolu sans accepter une hypothèse dangereuse concernant la réallocation de mémoire nouvellement allouée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Affected rules
MEM53-CPP
Description
In https://github.com/github/codeql/pull/14637 we added taint-flow through the indirection of the pointer passed to realloc to the indirection of the result. That is, flow through the following example:
int* p = ...;
*p = tainted_value;
int* q = (int*)realloc(p, 1024);
sink(*p);
this relies on the new taint-tracking library to distinguish between the result of realloc(...), and the result of what realloc(...) points to. Since the old AST-based taint-tracking library cannot do this this results in a FP in the testcases for MEM53-CPP (that we accepted on the next branch here: https://github.com/github/codeql-coding-standards/pull/419)
The query already tries to rule out realloc cases by excluding them in the definition of the taint-tracking configuration's isSource, but to get this query back to not reporting a FP here a barrier on realloc would have to be inserted.
As @jketema points out the affected test is actually really sketchy since there’s no guarantee that memory allocated with new can safely be realloc'ed. So maybe this scenario should be thought about more carefully by someone on your team.
- 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
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Ouvertefalse positive/false negative
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
github/codeql-coding-standards#1175 ·
Toutes les issues de github/codeql-coding-standards
Issues similaires
-
sponsored
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
microsoft/navcontainerhelper#4217 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
use-agent-os/agent-os#3314 ·
-
[aw] Upgrade available Ouverteagentic-workflows
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
githubnext/rig#534 ·
-
Implement GitHub Issue templates Ouvertedocumentation low-priority templates
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
jesseray718/openroot#87 ·