libzip: libzip-discuss: ">65535 files" extension still doesn't work

Thread

Thread Index

Message

From: Konstantin Isakov <dragonroot%gmail.com@localhost>
To: libzip-discuss%nih.at@localhost
Subject: ">65535 files" extension still doesn't work
Date: Thu, 28 May 2009 15:57:46 +0400

Hello,

I've tried the latest hg snapshot of libzip to see how new Infozip extension works. Turns out, it doesn't.
I dug a little, and here, e.g. we have the following code:

zip_open.c:247

for (i=0; i<cd->nentry; i++) {

if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) {

cd->nentry = i;

_zip_cdir_free(cd);

return NULL;

}

if (i == cd->nentry && left > 0) {

/* Infozip extension for more than 64k entries:

nentries wraps around, size indicates correct EOCD */

_zip_cdir_grow(cd, cd->nentry+ZIP_UINT16_MAX, error);

}

}


Now ( i == cd->nentry ) just can't ever be true, since the for() loop asserts i<cd->nentry. Furthermore, the nentry field is only adjusted
on cdir reading failure, but never on success. The whole loop seems to be in need of reorganization.


--
King's Sorrel rocks!

Made by MHonArc.