lumbda/c
russell@unturf.com a95277cef4
c: fix buffer overflow in load_file on non-seekable inputs
Bash process substitution <(...) passes /proc/self/fd/N — a pipe, not
a regular file. load_file used fseek(SEEK_END)+ftell to size a single-
read buffer; on a pipe ftell returns -1, which casts to SIZE_MAX as
fread's nbyte argument and blows the heap. Glibc fortify caught it
as '*** buffer overflow detected ***'.

Detect non-seekable input via the fseek return code and fall back to
a doubling growable buffer instead. Seekable path unchanged.

Repro: ~/git/lumbda/c/lumbda <(echo '(display 1)(newline)')
2026-06-04 12:44:43 -04:00
..
.gitignore rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
bench.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
builtins.c c: enable Boehm GC by default, GC_INIT, file ops, regression test 2026-06-04 00:55:31 -04:00
eval.c c: fix buffer overflow in load_file on non-seekable inputs 2026-06-04 12:44:43 -04:00
jit.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
jit.h rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
lumbda.h c: vm restores cur_code across CALL/RETURN, fixing JIT named-let hang 2026-06-04 01:11:18 -04:00
main.c c: enable Boehm GC by default, GC_INIT, file ops, regression test 2026-06-04 00:55:31 -04:00
Makefile c: enable Boehm GC by default, GC_INIT, file ops, regression test 2026-06-04 00:55:31 -04:00
portal.c portal-rng: add (random-seed-from-os!) across all three tiers 2026-04-20 15:50:26 -04:00
printer.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
reader.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
test.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
types.c cl-compat: run Zoë Trout's favorites unchanged (ticket 0004) 2026-04-24 07:02:21 -04:00
vm.c c: vm restores cur_code across CALL/RETURN, fixing JIT named-let hang 2026-06-04 01:11:18 -04:00