If the file in the original report is a valid .TAP image, please let
me know, as the patch here changes the 'spectrum' magic not to match
it, or anything else which has characters outside the ASCII range
(\001-\177) in the first position of its string match.

It would be nice if there was a variant of 'regex' which didn't search
by default. I'd like to be able to match a specific offset against a
regex--it would have made this patch much shorter and more rigorous.

I got a TAP demo file from:

http://zxaaa.untergrund.net/

and the magic seems to work properly on it.

I don't know how useful this is; is the magic too short? I haven't
been able to find a description of the .TAP format, so I don't know if
I've restricted the match enough or made it more complicated for
little to no real benefit.

Adam Buchbinder
--- file/magic/Magdir/spectrum	2009-02-16 10:59:52.000000000 -0500
+++ file/magic/Magdir/spectrum	2009-02-19 10:59:17.000000000 -0500
@@ -19,13 +19,17 @@
 # Tape file. This assumes the .TAP starts with a Spectrum-format header,
 # which nearly all will.
 #
-0       string          \023\000\000    Spectrum .TAP data
->4      string          x               "%-10.10s"
->3      byte            0               - BASIC program
->3      byte            1               - number array
->3      byte            2               - character array
->3      byte            3               - memory block
->>14    belong          0x001B0040      (screen)
+# Update: Sanity-check string contents to be printable.
+#  -Adam Buchbinder <[email protected]>
+# 
+0       string          \023\000\000
+>4      string          >\0
+>>4     string          <\177           Spectrum .TAP data "%-10.10s"
+>>>3    byte            0               - BASIC program
+>>>3    byte            1               - number array
+>>>3    byte            2               - character array
+>>>3    byte            3               - memory block
+>>>>14  belong          0x001B0040      (screen)
 
 # The following three blocks are from [email protected]
 # TZX tape images

Reply via email to