From 7d62e61608a8c54edc46eb5702287af84b045c69 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 14 Jul 2024 03:00:52 -0400 Subject: add sanity checking to BASIC header, in parse_header(). --- bas.c | 8 ++++++-- listbas.1 | 1 + listbas.rst | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bas.c b/bas.c index cf73fef..24508e4 100644 --- a/bas.c +++ b/bas.c @@ -115,13 +115,17 @@ void parse_header(void) { vvstart = vvtp - TBL_OFFSET; code_end = starp - TBL_OFFSET; - if(lomem) die("This doesn't look like an Atari BASIC program (no $0000 signature)."); - if(filelen < code_end) { fprintf(stderr, "Warning: file is truncated: %d bytes, should be %d.\n", filelen, code_end); } if(verbose) dump_header_vars(); + + /* these checks are actually kind of conservative. */ + if(lomem) die("Not an Atari BASIC program (no $0000 signature)."); + if(vntp < 0x100) die("Not an Atari BASIC program (invalid VNTP)."); + if(vvtp < vntd) die("Not an Atari BASIC program (invalid VVTP)."); + if(starp < vvtp) die("Not an Atari BASIC program (invalid STARP)."); } void update_header(void) { diff --git a/listbas.1 b/listbas.1 index 146df50..ba293f2 100644 --- a/listbas.1 +++ b/listbas.1 @@ -220,6 +220,7 @@ looks very similar to how it would appear on the Atari. \fBlistbas\fP does color syntax highlighting. .IP \(bu 2 \fBlistbas\fP only supports Atari BASIC, not Turbo BASIC or BASIC XL/XE. +This is a bug, not a feature... .IP \(bu 2 \fBlistbas\fP doesn\(aqt show information about the variables. Use \fBvxrefbas\fP(1) for that. diff --git a/listbas.rst b/listbas.rst index 46a44a4..63eb575 100644 --- a/listbas.rst +++ b/listbas.rst @@ -188,6 +188,7 @@ protection. - **listbas** does color syntax highlighting. - **listbas** only supports Atari BASIC, not Turbo BASIC or BASIC XL/XE. + This is a bug, not a feature... - **listbas** doesn't show information about the variables. Use **vxrefbas**\(1) for that. -- cgit v1.2.3