MEM-034 DONT: main() script slurp unchecked ftell/malloc/fread OOB (js/main.cpp)

Now
DONT

The script-file loader in main() slurps the file with no validation. long len = ftell(f) is unchecked: on a non-seekable file (pipe/FIFO/char device) ftell returns -1, so malloc(len+1) becomes malloc(0), fread is called with count (size_t)-1, and script[len]=='\0' writes script[-1] a deterministic heap-underflow OOB write. The malloc return is unchecked (NULL write under OOM) and the fread count is ignored (uninitialized bytes before the NUL parsed by JABCExecute). It also fopens argv[1] instead of the parsed script_file. Local CLI utility (operator is the actor), but the underflow is trivially reachable. The goal is to validate ftell>=0, check malloc, and terminate at the actual fread count.

Issues

Three unchecked stdio results feed alloc/index/terminate.

Blockers

None.

Planned

Validate sizes; terminate at the read count.