42 vulnerabilities classified as CWE-682 (数值计算不正确). AI Chinese analysis included.
CWE-682 represents a logic error where software performs calculations that yield incorrect or unintended results, subsequently influencing security-critical decisions or resource management. This weakness is typically exploited by attackers who manipulate input data to trigger arithmetic overflow, underflow, or precision errors, causing the system to miscalculate buffer sizes, access permissions, or authentication thresholds. Consequently, these miscalculations can lead to unauthorized privilege escalation, denial of service through resource exhaustion, or data corruption. To prevent such vulnerabilities, developers must implement rigorous input validation and employ safe arithmetic libraries that detect overflows before they occur. Additionally, using static analysis tools to identify risky mathematical operations and conducting thorough code reviews for complex logic ensures that calculations remain accurate and secure under all expected and unexpected input conditions.
img_t table_ptr; /*struct containing img data, 10kB each*/ int num_imgs; ... num_imgs = get_num_imgs(); table_ptr = (img_t*)malloc(sizeof(img_t)*num_imgs); ...... int touchdowns = team.getTouchdowns(); int yardsGained = team.getTotalYardage(); System.out.println(team.getName() + " averages " + yardsGained / touchdowns + "yards gained for every touchdown scored"); ...Vulnerabilities classified as CWE-682 (数值计算不正确) represent 42 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.