Run cbm_extract_file in a forked child; return true if the child died from a * signal (SIGBUS/SIGSEGV/...). ASan does not install a SIGBUS handler, so an * in-process crash would terminate the whole test runner — forking isolates it * and lets us assert "extraction must not crash" deterministically. * * Windows (msys2) has no fork()/waitpid(): run in-process. A genuine crash there * aborts t
| 225 | * aborts the runner (a hard, visible failure), and the fork-isolated check still |
| 226 | * runs on the POSIX CI legs, so coverage is preserved. */ |
| 227 | static bool extract_crashes(const char *content, CBMLanguage lang, const char *relpath) { |
| 228 | #if defined(_WIN32) |
| 229 | CBMFileResult *r = |
| 230 | cbm_extract_file(content, (int)strlen(content), lang, "lc", relpath, 0, NULL, NULL); |
| 231 | if (r) { |
| 232 | cbm_free_result(r); |
| 233 | } |
| 234 | return false; |
| 235 | #else |
| 236 | fflush(NULL); |
| 237 | pid_t pid = fork(); |
| 238 | if (pid < 0) { |
| 239 | return false; /* cannot fork — do not flag a crash we can't observe */ |
| 240 | } |
| 241 | if (pid == 0) { |
| 242 | CBMFileResult *r = |
| 243 | cbm_extract_file(content, (int)strlen(content), lang, "lc", relpath, 0, NULL, NULL); |
| 244 | if (r) { |
| 245 | cbm_free_result(r); |
| 246 | } |
| 247 | _exit(0); |
| 248 | } |
| 249 | int status = 0; |
| 250 | (void)waitpid(pid, &status, 0); |
| 251 | return WIFSIGNALED(status); |
| 252 | #endif |
| 253 | } |
| 254 | |
| 255 | /* ══════════════════════════════════════════════════════════════════ |
| 256 | * KNOWN-BUG CONTRACTS (must FAIL until fixed) — see P2 |
no test coverage detected