forked from arti/vt1200
The TFTP font path loads through 3F96B850 and parses with the metadata reader 3F97EF00, which handles only PROPERTIES/ACCELERATORS/METRICS/ ENCODINGS and silently skips BITMAPS. A font with num_chars=0x40000001 therefore passes the loader (LOADER-A-SUCCESS) without the field ever being read, and pcfReadBitmaps (3F984970, multiply 3F985050) is never entered. pcfReadBitmaps has exactly one caller, 3F98BB70, in the X11 font-request reader 3F98AC20, not the TFTP fetch path. The 'refused after 1024 bytes' of evil-real.pcf is the METRICS table: its big-endian compressed count 0x00DF is read little-endian as 57088, so fosAlloc(57088*16) fails at ~906 bytes; BITMAPS (offset 2024) is never reached. Baseline.pcf fails the same way; baseline_le.pcf puts that one 2-byte field in the order the loader reads it, parses cleanly, and still ignores the crafted BITMAPS count. No ROM patch, no check disabled, no serve.py edit. Baselines unchanged: no env samples=198, stub samples=53.
46 lines
1.8 KiB
Bash
Executable File
46 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run one candidate font through the terminal's own TFTP loader, with the PCF
|
|
# parser traced. Everything happens inside the isolated netns vt1test so the
|
|
# owner's tap is untouched.
|
|
#
|
|
# run_candidate.sh <candidate.pcf> [seconds] [trace.lua] [extra mame args...]
|
|
set -euo pipefail
|
|
NS=vt1test
|
|
ROOT=/home/arti/code/k-space/vt1200
|
|
WORK=$ROOT/harness/mame/pcfwork
|
|
CAND="${1:?usage: run_candidate.sh <candidate.pcf> [seconds] [trace.lua]}"
|
|
SECS="${2:-40}"
|
|
TRACE="${3:-$WORK/pcftrace.lua}"
|
|
shift 3 2>/dev/null || true
|
|
|
|
sudo -n ip netns exec "$NS" pkill -x vt1200 2>/dev/null || true
|
|
sudo -n ip netns exec "$NS" pkill -f serve_candidate.py 2>/dev/null || true
|
|
sleep 0.3
|
|
rm -rf "$WORK/nvram-run" "$WORK/debug.log"
|
|
mkdir -p "$WORK/nvram-run/vt1200"
|
|
cp "$WORK/nvram-pristine.bin" "$WORK/nvram-run/vt1200/nvram"
|
|
|
|
sudo -n ip netns exec "$NS" python3 -u "$WORK/serve_candidate.py" "$CAND" \
|
|
>"$WORK/serve.log" 2>&1 &
|
|
SRV=$!
|
|
sleep 1.2
|
|
|
|
cd "$WORK"
|
|
timeout $((SECS+15)) sudo -n ip netns exec "$NS" env -u DISPLAY \
|
|
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy \
|
|
XDG_RUNTIME_DIR="$WORK" VT1200_SKIP_LEVEL1=1 \
|
|
/home/arti/code/k-space/mame0289/vt1200 vt1200 \
|
|
-rompath "$ROOT/harness/mame/roms" -video none -sound none -nothrottle \
|
|
-skip_gameinfo -cfg_directory "$WORK/cfg" \
|
|
-nvram_directory "$WORK/nvram-run" -networkprovider taptun \
|
|
-debug -debugger none -debuglog \
|
|
-autoboot_script "$TRACE" -autoboot_delay 0 \
|
|
-seconds_to_run "$SECS" >"$WORK/mame_run.log" 2>&1 || true
|
|
|
|
kill $SRV 2>/dev/null || true
|
|
sudo -n ip netns exec "$NS" pkill -f serve_candidate.py 2>/dev/null || true
|
|
echo "=== server ==="
|
|
cat "$WORK/serve.log"
|
|
echo "=== parser trace ==="
|
|
grep -E "TOC|BITMAPS|MULTIPLY|OFFSETS|VALIDATE|FAIL|TFTP-READ" "$WORK/debug.log" | head -200
|