CPP: Add query for CWE-783 Operator Precedence Logic Error When Use Bool Type#5325
Conversation
|
Good day. |
|
Hi @ihsinme, Thanks for another contribution. Sorry we haven't got around to reviewing your PR yet, but it's on our radar :) You will get a review very soon! |
|
I've done an initial run on LGTM: https://lgtm.com/query/1099721324323715668/ Most of those results are true positives, but there's one false positive here using a custom Thanks for the query and for including the test and example. |
|
thanks for your corrections. |
Co-authored-by: Robert Marsh <rdmarsh2@gmail.com>
thanks for the bug found. |
|
to avoid losing the situation when the developer got confused and named the variables of different types the same. |
|
good day. |
|
Ping @rdmarsh2. |
|
thanks |
Good day.
This PR is looking for three situations of unsafe use of the bullish type.
it is the increment and negation applied to the boolean variable.
from a coding point of view, this does not change the value of the boolean variable, and requires developer attention.
Also, this is a situation of assigning a value to a function and simultaneously comparing its result, in the absence of a set priority, leads to confusion.
Information about the found and accepted fix in the project: SerenityOS/serenity#4494