uzip extfs sanity patch
Standa Opichal
opichals at seznam.cz
Wed Nov 20 16:25:13 UTC 2002
Hi!
On Wed, 20 Nov 2002, Pavel Roskin wrote:
> > Here is a small patch I needed to display one particular archive
> > contents without errors. If it is convenient to neglect errors like weird
> > dates then it can be usefull. Maybe even the other archive scripts should
> > have such checks? What do you think?
> ...
> My suspicion is that the problem is not specific to that archive. Maybe
> the months are displayed in some other language, or something like that.
The problem is the archive. It is Atari ST filesystem (according to the
unzip -Zv) entry. Atari ST computers didn't have the real time clock
backup so that the clock sets some weird date after switch off/on of the
machine. User needed to set it up manually by themselves. I simply checked
the month (in the wrong entries - 015) to the range it should be. IIRC ST
displays the Dec 31 2028. Actuall there is the date stamp like 0xffff ( =>
year = 0x7f+1980, mon = 0xf, day = 0x1f ) and this is exactly what is
happening here. The only value that can be wrong here (at least for
unzip executables - studying its sources) is the month number so the
sanity range shrinkage is IMO ok here. And maybe there should be the same
(range) checks also for the year, date and other data?
best regards
STan
PS: Here are the snippets:
$ unzip -Z MagiC_61_Atari.zip
Archive: MagiC_61_Atari.zip 851674 bytes 85 files
-rwxrwxrwx 2.0 atr 9092 b- defN 31-015-07 31:23 MAGX_1/_COPY/GEMSYS/OFF65KPK.OSD
-rwxrwxrwx 2.0 atr 10045 b- defN 31-015-07 31:23 MAGX_1/_COPY/GEMSYS/OFF32KPK.OSD
-rwxrwxrwx 2.0 atr 8787 b- defN 9-Apr-01 01:28 MAGX_1/_COPY/GEMSYS/OFF32KFL.OSD
-rwxrwxrwx 2.0 atr 17482 b- defN 9-Apr-01 01:28 MAGX_1/_COPY/GEMSYS/OFF256PK.OSD
$ perl /tmp/uzip list MagiC_61_Atari.zip 2>/dev/null
Use of uninitialized value in printf at /tmp/uzip line 288.
-rw-r--r-- 1 644 100 9092 31 2107 31:23 MAGX_1/_COPY/GEMSYS/OFF65KPK.OSD
Use of uninitialized value in printf at /tmp/uzip line 288.
-rw-r--r-- 1 644 100 10045 31 2107 31:23 MAGX_1/_COPY/GEMSYS/OFF32KPK.OSD
-rw-r--r-- 1 644 100 8787 Apr 09 2001 01:28 MAGX_1/_COPY/GEMSYS/OFF32KFL.OSD
-rw-r--r-- 1 644 100 17482 Apr 09 2001 01:28 MAGX_1/_COPY/GEMSYS/OFF256PK.OSD
$ perl /tmp/uzip-fixed list MagiC_61_Atari.zip
-rw-r--r-- 1 644 100 9092 Dec 31 2107 31:23 MAGX_1/_COPY/GEMSYS/OFF65KPK.OSD
-rw-r--r-- 1 644 100 10045 Dec 31 2107 31:23 MAGX_1/_COPY/GEMSYS/OFF32KPK.OSD
-rw-r--r-- 1 644 100 8787 Apr 09 2001 01:28 MAGX_1/_COPY/GEMSYS/OFF32KFL.OSD
-rw-r--r-- 1 644 100 17482 Apr 09 2001 01:28 MAGX_1/_COPY/GEMSYS/OFF256PK.OSD
$ "extract from" zipinfo.c
{
yr = ((unsigned)(*datetimez >> 25) & 0x7f) + 80;
mo = ((unsigned)(*datetimez >> 21) & 0x0f);
dy = ((unsigned)(*datetimez >> 16) & 0x1f);
hh = (((unsigned)*datetimez >> 11) & 0x1f);
mm = (((unsigned)*datetimez >> 5) & 0x3f);
ss = (((unsigned)*datetimez << 1) & 0x3e);
}
More information about the mc-devel
mailing list