codeql icon indicating copy to clipboard operation
codeql copied to clipboard

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

Open ihsinme opened this issue 3 years ago • 0 comments
trafficstars

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 avatar Sep 15 '22 06:09 ihsinme