`MEM53-CPP`: False positive due to flow through `realloc`
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 30/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- cpp
- Domínio
- devtools, testing-qa
Direção de pesquisa
Comece pelos casos de teste de MEM53-CPP e pela definição de isSource da configuração de taint-tracking; em seguida, revise os pull requests vinculados referentes à alteração no fluxo de realloc. Determine como a biblioteca antiga baseada em AST trata realloc e se o cenário de teste afetado é válido; considera-se concluído quando o falso positivo for resolvido sem aceitar uma suposição insegura sobre realocar memória recém-alocada.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- CodeQL
- Estrelas
- 227
- Forks
- 82
- Merge médio
- 6d 7h
- PRs com merge (30d)
- 9
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Abertafalse positive/false negative
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
github/codeql-coding-standards#1175 ·
Todas as issues de github/codeql-coding-standards
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 86/100
DavidAnson/markdownlint-cli2#940 ·
-
Claiming namespace Londopy Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
EclipseFdn/open-vsx.org#13385 · 1 comentário ·
-
bug ci good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100