Allow archives with MasterEOF==0, since it appears an old version of

ShrinkIt created them.  We continue to block MasterEOF==48, which was
the original cause for concern.
This commit is contained in:
Andy McFadden 2004-03-09 18:31:22 +00:00
parent 47d3e33265
commit 1af00b27d0
3 changed files with 25 additions and 3 deletions

View File

@ -607,6 +607,11 @@ retry:
goto bail;
}
if (pArchive->junkOffset != 0) {
DBUG(("+++ found apparent start of archive at offset %ld\n",
pArchive->junkOffset));
}
crc = 0;
pHeader->mhMasterCRC = Nu_ReadTwo(pArchive, fp);
pHeader->mhTotalRecords = Nu_ReadFourC(pArchive, fp, &crc);
@ -626,7 +631,7 @@ retry:
}
if (pHeader->mhMasterVersion > kNuMaxMHVersion) {
err = kNuErrBadMHVersion;
Nu_ReportError(NU_BLOB, err, "Bad MH version %u",
Nu_ReportError(NU_BLOB, err, "Bad Master Header version %u",
pHeader->mhMasterVersion);
goto bail;
}
@ -650,8 +655,16 @@ retry:
* 3.5" disk across a slow AppleTalk network. The only obvious
* indication of brain-damage, until you try to unpack the archive,
* seems to be a bogus MasterEOF==48.
*
* Matthew Fischer found some archives that exhibit MasterEOF==0
* but are otherwise functional, suggesting that there might be a
* version of ShrinkIt that created these without reporting an error.
* One such archive was a disk image with no filename entry, suggesting
* that it was created by an early version of P8 ShrinkIt.
*
* So, we only fail if the EOF equals 48.
*/
if (pHeader->mhMasterEOF <= kNuMasterHeaderSize) {
if (pHeader->mhMasterEOF == kNuMasterHeaderSize) {
err = kNuErrNoRecords;
Nu_ReportError(NU_BLOB, err,
"Master EOF is %ld, archive is probably truncated",

View File

@ -1,3 +1,10 @@
2004/03/09 fadden
- Set access permissions based on umask when extracting a "locked"
file. My thanks to Matthew Fischer for sending a patch.
- Reject archives with a MasterEOF == 48, not <= 48. There are
some otherwise valid archives created by an old version of ShrinkIt
that have MasterEOF==0.
2003/10/16 ***** v2.0.1 shipped *****
2003/10/16 fadden

View File

@ -461,8 +461,10 @@ Nu_ScanThreads(NuArchive* pArchive, NuRecord* pRecord, long numThreads)
* end up with a disk image that had no name attached. This will tend
* to confuse things, so we go ahead and give it a name.
*/
if (pRecord->filename == nil)
if (pRecord->filename == nil) {
DBUG(("+++ no filename found, using default record name\n"));
pRecord->filename = kNuDefaultRecordName;
}
pArchive->currentOffset += pRecord->totalCompLength;