View Issue Details

IDProjectCategoryView StatusLast Update
0000622filegeneralpublic2017-07-03 16:04
ReporterChristian Höltje 
Assigned ToChristos Zoulas 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.31 
Target VersionFixed in VersionHEAD 
Summary0000622: infocom "release" value is incorrectly limited to less than 10
DescriptionThe current magic looks like this:

# It might be possible to sanity-check the release number as well, as it seems
# (at least in classic Infocom games) to always be a relatively small number,
# always under 150 or so, but as this isn't rigorous, we'll wait on that until
# it becomes clear that it's needed.
#
# 0 ubyte >0
# >0 ubyte <9
# >>16 belong&0xfe00f0f0 0x3030
# >>>0 ubyte < 10
# >>>>2 ubeshort < 10
# >>>>>18 regex [0-9][0-9][0-9][0-9][0-9][0-9]
# >>>>>>0 ubyte < 10 Infocom (Z-machine %d,
# >>>>>>>2 ubeshort < 10 Release %d /
# >>>>>>>>18 string >\0 Serial %.6s)
# !:strength + 40
# !:mime application/x-zmachine

However, despite the comment the Release _is_being constrained to "< 10" (the two "2 ubeshort" lines).

Putting _any_ constraint on this is incorrect. I have seen official values as high as 393 ("Zork Zero - The Revenge of Megaboz").

I would recommend removing the first "2 ubeshort" line, un-">" the rest of the lines and replace the test in the second "2 ubeshort" to "x".
Steps To ReproduceGrab this infocom file from archive.org:

https://archive.org/details/Zork1Release88Z-machineFile

Running file on it produces:

$ file zork1.z3
zork1.z3: data

I expected this instead:

$ file zork1.z3
zork1.z3: Infocom (Z-machine 3, Release 88 / Serial 840726)
Additional InformationThis was broken by this commit:

https://github.com/file/file/commit/2ac2641e30c0e772e03d4964941b33e78957a8e3

The change from "0 ubyte x" to "0 ubyte < 10" was fine.

But the change from "2 ubeshort x" to "2 ubeshort < 10" was bad.
Tagsregression

Relationships

Activities

Christian Höltje

Christian Höltje

2017-07-01 03:35

reporter   ~0001544

Proposed patch:

diff --git a/magic/Magdir/adventure b/magic/Magdir/adventure
index 120e3d8c..e146bdc5 100644
--- a/magic/Magdir/adventure
+++ b/magic/Magdir/adventure
@@ -36,11 +36,10 @@
 >0 ubyte <9
 >>16 belong&0xfe00f0f0 0x3030
 >>>0 ubyte < 10
->>>>2 ubeshort < 10
->>>>>18 regex [0-9][0-9][0-9][0-9][0-9][0-9]
->>>>>>0 ubyte < 10 Infocom (Z-machine %d,
->>>>>>>2 ubeshort < 10 Release %d /
->>>>>>>>18 string >\0 Serial %.6s)
+>>>>18 regex [0-9][0-9][0-9][0-9][0-9][0-9]
+>>>>>0 ubyte < 10 Infocom (Z-machine %d,
+>>>>>>2 ubeshort x Release %d /
+>>>>>>>18 string >\0 Serial %.6s)
 !:strength + 40
 !:mime application/x-zmachine
Christos Zoulas

Christos Zoulas

2017-07-03 16:04

manager   ~0001545

fixed thanks.

Issue History

Date Modified Username Field Change
2017-07-01 03:33 Christian Höltje New Issue
2017-07-01 03:33 Christian Höltje Tag Attached: regression
2017-07-01 03:35 Christian Höltje Note Added: 0001544
2017-07-03 16:04 Christos Zoulas Assigned To => Christos Zoulas
2017-07-03 16:04 Christos Zoulas Status new => resolved
2017-07-03 16:04 Christos Zoulas Resolution open => fixed
2017-07-03 16:04 Christos Zoulas Fixed in Version => HEAD
2017-07-03 16:04 Christos Zoulas Note Added: 0001545