Probable Context-Aware Warnings for Floating-Point Equality Comparisons
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
Read the issue’s linked Secure Coding Guide section for CWE-664/CWE-197 and review the floating-point equality examples it cites from NeMo and PyTorch. The issue asks whether warnings should be context-dependent, but gives no proposed change or acceptance criteria; done would require agreeing on guidance and updating the relevant guide section to reflect it.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
I am working at OpenRefactory, a static analysis tool company. Our CEO, @openrefactorymunawar previously had some interactions with you and we have been improving our tool by adding the capability to detect some of the bugs that you are describing.
I have a question for one such bug pattern.
Recently, we introduced a fixer that flags warnings when floating-point values are used in equality comparisons. This practice is known to be problematic, as it can lead to unexpected outcomes due to the inherent imprecision of floating-point arithmetic.
The idea for this improvement was inspired by the guidance provided in the
Secure Coding Guide for Python (CWE-664/CWE-197)
Upon running this fixer on various projects, we found a significant number of instances where equality comparisons with floating-point values were being used. For example:
PyTorch 67 instances
NVIDIA Nemo 28 instances
Examples of such occurrences:
This raises a question: Could some of these cases be deliberate on the developers' part, where they knowingly use equality comparisons with floating-point values despite the risks, perhaps for a valid use case? If so, should we raise this warning universally, or should it be more context-dependent?
I'd love to hear your thoughts on this.
- Linguagem predominante
- Python
- Estrelas
- 2
- Forks
- 2
- Merge médio
- 11min
- PRs com merge (30d)
- 2
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o 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 ossf/python-secure-coding-guide
-
pyscg-0051 should use a context managerTalvez já em andamento @s19110 assumiu há 8 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ossf/python-secure-coding-guide#1 · 4 comentários · 1 responsável ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
ossf/python-secure-coding-guide#29 · 1 comentário ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
Todas as issues de ossf/python-secure-coding-guide
Issues semelhantes
-
documentation type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
add entry to blockAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 65/100
StevenBlack/hosts#3299 ·
-
`garak --report` overwrites the input report when its name has no ".report"Talvez já em andamento @0z5a assumiu hoje. Abertaneeds-triage
Dificuldade 2/5 Meio dia Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 2 dias
-
trace: Pi's 1-hour cache writes are priced at 1.25x, but billed at 2xTalvez já em andamento @Shizoqua assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
microsoft/TokenEconomizer#221 ·
Mantenedores costumam responder em até 1 dia
-
plot_graph crashes when a mesh node has no m2m edgeTalvez já em andamento @tygvi assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
mllam/neural-lam#883 · 1 comentário ·
Mantenedores costumam responder em até 2 dias