Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPP: Add query for CWE-369: Divide By Zero. #10431

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ihsinme
Copy link
Contributor

@ihsinme ihsinme commented Sep 15, 2022

good afternoon.
this query should find situations where the return value from some function might become part of the denominator and result in a division by zero.
this error is widely represented in projects.

detecting: CVE-2018-18190.
it is worth noting that the detection would be much wider, for example, it would cover colors such as CVE-2021-34069 if GlobalValueNumbering could work with FieldAccess.

I also ask for help in optimizing this query, after trying to make it look laconic, I got extremely poor performance, while quite trivial changes, such as moving msg to a common place or removing divFn, lead to an even greater slowdown.
It is difficult for me to move without having an understanding of the work of the optimizer, so I ask for any advice. if you don’t have them, I’ll have to move back, moving away from the laconic look.

Thanks.

@ihsinme ihsinme requested a review from a team as a code owner Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant