|
This figure is a code implemented according to the requirements of Cases 1 and 2, and an integer overflow occurs. The two cases' requirements are different, but the developer assumes that a program user enters the input defined in the specification, so they write the same code for both cases. If this code is the code that Case 1 is implemented, it satisfies reliability, but not security. Case 1 requirement is that finding N out of a number from 1 to 100. Then, first and last within the defined input range have a value from 1 to 100. However, first and last within the undefined input range can also be received from the binary search function. In the code implemented according to Case 1, integer overflow will not occur due to first and last within the defined input range. Nevertheless, integer overflow will occur when first and last within the undefined input range are entered. If this code is the code that Case 2 is implemented, it does not satisfy reliability and security. According to the Case 2 requirement, the first and last within the defined input range have numbers from 1 to INT_MAX-1. The first and last within the undefined input range are INT_MAX. In this case, an integer overflow will occur regardless of whether it is defined as an input or not. Since both cases 1 and 2 do not satisfy security, it allows that deliberate or accidental intrusion. The difference is whether or not the reliability is satisfied. Suppose a reliability-oriented group runs static analysis tools for a code implemented according to Case 1, and an integer overflow alarm occurs. In that case, they will judge that it is a false positive. However, suppose the same group runs a static analysis tool for a code implemented according to Case 2, and an integer overflow alarm occurs. In that case, they will determine that it is a true positive. And suppose a security-oriented group runs a static analysis tool for codes implemented according to Case 1 and Case 2, and an integer overflow alarm occurs. In that case, they will determine that it is a true positive. |