RS.DBZ.GENERAL.FLOAT
Assigned zero float constant value might be used in a division by floating-point zero
An attempt to do a division or modulo operation using zero as the divisor causes a runtime error. Division by zero defects often occur due to ineffective error handling or race conditions, and typically cause abnormal program termination. Before a value is used as the divisor of a division or modulo operation in Rust code, it must be checked to confirm that it is not equal to zero.
The RS.DBZ checkers look for instances in which a zero constant value is used as the divisor of a division or modulo operation.
The RS.DBZ.GENERAL.FLOAT checker flags situations in which a variable that has been assigned a zero constant value locally or as the result of a function call, might later be used as a divisor in a division or modulo operation without being checked for zero.
Vulnerability and risk
Float division by zero usually results in the failure of the process or in an exception. It can also result in the success of the operation, but gives an erroneous answer. Floating-point division by zero is more subtle. It depends on the implementation of the compiler.
Mitigation and prevention
Division by zero issues typically occur due to ineffective exception handling. To avoid this vulnerability, check for a zero value before using it as the divisor of a division or modulo operation.