aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-14 03:00:52 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-14 03:00:52 -0400
commit7d62e61608a8c54edc46eb5702287af84b045c69 (patch)
tree2b68d6de20fee64fe7408b271995f3720b43602a
parentdfc8edb273235c2494bad0d119990b2981978cbb (diff)
downloadbw-atari8-tools-7d62e61608a8c54edc46eb5702287af84b045c69.tar.gz
add sanity checking to BASIC header, in parse_header().
-rw-r--r--bas.c8
-rw-r--r--listbas.11
-rw-r--r--listbas.rst1
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.