Zip problems (Re: (no subject))

Nicolas Goutte nicog at snafu.de
Sat Nov 16 23:13:53 GMT 2002


(In short: kdelibs/kio/kio/kzip.cpp has a bug that make KOffice unable to save 
anything correctly.)

As this problem seems not over at all, here are my observations.

The file saved by KWord is corrupted. Unzip does not recognised the file as a 
ZIP file. However "zip -FF" can recover the file it seems (for those who have 
lost their texts.)

The problem that I have noticed is that the first entry of the central 
directory is corrupted. Such an entry should start with the bytes 'P', 'K', 
1, 2. However the first entry has not this sequence.

I suppose that the sequence is overwritten by something. I have not found out 
what.

(Nevertheless, while browsing the code, I have found a bug for 
stored/uncompressed files in the ZIP.)

Have a nice day/evening/night!

On Thursday 14 November 2002 19:17, David Faure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thursday 14 November 2002 14:31, ismail donmez wrote:
> > On Thursday 14 November 2002 13:07, David Faure wrote:
> > > On Thursday 14 November 2002 08:10, Percy Leonhardt
> >
> > wrote:
> > > > On Monday 11 November 2002 08:52, ismail donmez
> >
> > wrote:
> > > > > KZip: WARNING Unrecognized header at offset
> >
> > <foo> and
> >
> > > > > it shows "Invalid file . Maindoc.xml not found"
> >
> > in gui
> >
> > > > > and exits when I press ok.
> > > >
> > > > There was no answer to this mail on the koffice
> >
> > list so I thought I
> >
> > > > forward it to koffice-devel. The bug happens with
> >
> > all OpenOffice files
> >
> > > > and thus makes it impossible to code on the
> >
> > importfilters... at least
> >
> > > > when you want to test them.
> > >
> > > I am not able to reproduce this problem, at least
> >
> > with the ascii import
> >
> > > filter. I tried debugging this with another person
> >
> > having the problem, and
> >
> > > all we got to, was that the problem is when writing
> >
> > (after using
> >
> > > koconverter, unzip says the .kwd file isn't a valid
> >
> > Zip file).
> >
> > > Can you reproduce this bug when importing a .txt
> >
> > file too? Can you confirm
> >
> > > that if you use koconverter, the .kwd is an invalid
> > >ZIP?
> >
> > Ok here what I tested more on my machine :
>
> Yeah I can reproduce it too, now, with a .sxw file.
> The bug is in Holger Schröder's last commit to kzip.cpp (which was a rather
> big change). I'm trying to debug it, but it's a bit hard, without knowing
> the ZIP file format at all.
>
> $ ./kziptest list /k/mytext.sxw
> Read from offset : 0
> P
> K
> \x03
> \x04
> compressed file size=0    (looks wrong!)
> filenamelength=11         (which is ok for "contents.xml")
> extra field length=0
> skip=11
> dev->at()=41
> offset=41
> Read from offset : 41
> \xad
> V
> \xdb
> n
> KZip: WARNING: Invalid ZIP file. Unrecognized header at offset 41
>
> I tried changing the offset where the compressed file size is read, but I
> get 0 in all cases....
>
> But unzip manages to find the data....
>  Length   Method    Size  Ratio   Date   Time   CRC-32    Name
> - --------  ------  ------- -----   ----   ----   ------    ----
>     2593  Defl:N      895  66%  03-06-02 19:12  29e00009  content.xml
> [...]
>
> Strange, I can't find 2593 nor 895 with khexedit (??)
> Holger - help!
>
> - --
> David FAURE, david at mandrakesoft.com, faure at kde.org
> http://people.mandrakesoft.com/~david/
> Contributing to: http://www.konqueror.org/, http://www.koffice.org/
> Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
>
> iD8DBQE90+ii72KcVAmwbhARAvAhAJ0Vz7XkA8OwBj9zJjgD6lEcd5ty+gCgg/OQ
> +FmwydeDK8PSpUL+PL5uAWI=
> =+S+S
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> koffice-devel mailing list
> koffice-devel at mail.kde.org
> http://mail.kde.org/mailman/listinfo/koffice-devel





More information about the kde-core-devel mailing list