Summary
In process_hex() in src/lib_ccx/general_loop.c, two return
values are not checked:
-
fopen() on line 370 — if the file cannot be opened, fr
is NULL and the subsequent fgets(fr) call will crash
with a segfault.
-
alloc_demuxer_data() on line 374 — return value is never
checked. If allocation fails, data will be NULL and cause
undefined behavior when used later.
Code
FILE *fr = fopen(filename, "rt"); // ← no NULL check
// ...
struct demuxer_data *data = alloc_demuxer_data(); // ← no NULL check
while (fgets(line, max - 1, fr) != NULL) // ← crashes if fr is NULL
Suggested Fix
Add NULL checks for both with appropriate fatal() calls,
freeing already-allocated resources before exiting.