codeql
codeql copied to clipboard
CPP: Add query for CWE-369: Divide By Zero.
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.