fold/tests/fixtures/binary/cwe/cwe369_div0.c
trvon fd4a68dfff
test: add coverage for project graph, pcode encoder, and detector behaviors
Unit + integration coverage for the session's work: incremental project
graph/index, pcode encoder, unreachable/dead-branch, equiv/cross-TU,
div-by-zero/sign-conversion/int-truncation, use-after-free, quality-precision,
scan-router profile, source TU runner, detector plan, and the eval fixtures.
2026-08-16 16:46:07 -06:00

10 lines
291 B
C

// CWE-369: divide by zero (divisor from argv, no check).
#include <stdlib.h>
__attribute__((noinline)) int vuln(int d) {
return 100 / d; // sink: division by attacker-controlled d
}
int main(int argc, char** argv) {
if (argc > 1)
return vuln(atoi(argv[1]));
return 0;
}