fold/tests/fixtures/binary/cwe/cwe416_uaf.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

9 lines
231 B
C

// CWE-416: use after free.
#include <stdlib.h>
__attribute__((noinline)) int vuln(void) {
int* p = (int*)malloc(sizeof(int));
*p = 7;
free(p);
return *p; // sink: use after free
}
int main(void) { return vuln(); }