zip freezes - how to handle corrupt CRC in zip-file

This is a discussion on zip freezes - how to handle corrupt CRC in zip-file within the PHP General forums, part of the PHP Programming Forums category; Hi @all, i´m reading zip-files with the php zip-functions without a problem. Now i got and Zip ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-14-2007
ecc
 
Posts: n/a
Default zip freezes - how to handle corrupt CRC in zip-file


Hi @all,

i´m reading zip-files with the php zip-functions without a problem. Now i
got and Zip containing an corrupt crc (If i open this file via winzip, the
error is shown).

It looks like the php functions for zip-handeling "zip_entry_read" and
"ZipArchive::getFrom..." do not quit on a bad crc checksum.... so these
functions read in the file and than are in an infinite loop. Because i use
PHP-GTK2 my tool feezes and the process has to be killed. On an
web-enviroment this could also a big problem ..... ok, user-zip handeling on
web is not the best idea :-)

I´ve found no way to find out, if an file in the zip file is an valid or
corrupt entry. The output of "ZipArchive::statName" give me no info about
the state of an entry.

Is there any trick out there, how to manage this problem. Maybe this is an
bug or missing feature in the zip extensions. Dont know!

Regards,
Andreas
--
View this message in context: http://www.nabble.com/zip-freezes---...html#a12142189
Sent from the PHP - General mailing list archive at Nabble.com.
Reply With Quote
  #2 (permalink)  
Old 08-14-2007
sanjeevn
 
Posts: n/a
Default Re: [PHP] zip freezes - how to handle corrupt CRC in zip-file

Use error handling function for time being and exit from the loop
where control going in the loop.


On 8/14/07, ecc <ecc@camya.com> wrote:
>
>
> Hi @all,
>
> i´m reading zip-files with the php zip-functions without a problem. Nowi
> got and Zip containing an corrupt crc (If i open this file via winzip, the
> error is shown).
>
> It looks like the php functions for zip-handeling "zip_entry_read" and
> "ZipArchive::getFrom..." do not quit on a bad crc checksum.... so these
> functions read in the file and than are in an infinite loop. Because i use
> PHP-GTK2 my tool feezes and the process has to be killed. On an
> web-enviroment this could also a big problem ..... ok, user-zip handeling
> on
> web is not the best idea :-)
>
> I´ve found no way to find out, if an file in the zip file is an valid or
> corrupt entry. The output of "ZipArchive::statName" give me no info about
> the state of an entry.
>
> Is there any trick out there, how to manage this problem. Maybe this is an
> bug or missing feature in the zip extensions. Dont know!
>
> Regards,
> Andreas
> --
> View this message in context:
> http://www.nabble.com/zip-freezes---...html#a12142189
> Sent from the PHP - General mailing list archive at Nabble.com.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--
Warm Regards
Sanjeev
------------------------------------------------
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com/
http://webhosting.sanchanworld.com/

Reply With Quote
  #3 (permalink)  
Old 08-14-2007
ecc
 
Posts: n/a
Default Re: [PHP] zip freezes - how to handle corrupt CRC in zip-file


Hi Sanjeev,
thank you for your fast answer.
what do you mean with "error handling function" ()? If i read in the
zip_entry, the function is freezing.... no chance to handle the error,
because php dont give me an error or exception. If php find a corrupt file,
it freezes on this position. Maybe i can post the corrupt zip, so somebody
can try it :-)

Thank you for your idea.
Andreas


Sanjeev N wrote:
>
> Use error handling function for time being and exit from the loop
> where control going in the loop.
>
>
> On 8/14/07, ecc <ecc@camya.com> wrote:
>>
>>
>> Hi @all,
>>
>> i´m reading zip-files with the php zip-functions without a problem.Now i
>> got and Zip containing an corrupt crc (If i open this file via winzip,
>> the
>> error is shown).
>>
>> It looks like the php functions for zip-handeling "zip_entry_read" and
>> "ZipArchive::getFrom..." do not quit on a bad crc checksum.... so these
>> functions read in the file and than are in an infinite loop. Because i
>> use
>> PHP-GTK2 my tool feezes and the process has to be killed. On an
>> web-enviroment this could also a big problem ..... ok, user-zip handeling
>> on
>> web is not the best idea :-)
>>
>> I´ve found no way to find out, if an file in the zip file is an valid or
>> corrupt entry. The output of "ZipArchive::statName" give me no info about
>> the state of an entry.
>>
>> Is there any trick out there, how to manage this problem. Maybe this is
>> an
>> bug or missing feature in the zip extensions. Dont know!
>>
>> Regards,
>> Andreas
>> --
>> View this message in context:
>> http://www.nabble.com/zip-freezes---...html#a12142189
>> Sent from the PHP - General mailing list archive at Nabble.com.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

>
>
> --
> Warm Regards
> Sanjeev
> ------------------------------------------------
> http://www.sanchanworld.com/
> http://webdirectory.sanchanworld.com/
> http://webhosting.sanchanworld.com/
>
>


--
View this message in context: http://www.nabble.com/zip-freezes---...html#a12142440
Sent from the PHP - General mailing list archive at Nabble.com.
Reply With Quote
  #4 (permalink)  
Old 08-14-2007
Richard Lynch
 
Posts: n/a
Default Re: [PHP] zip freezes - how to handle corrupt CRC in zip-file

On Tue, August 14, 2007 5:42 am, ecc wrote:
> i´m reading zip-files with the php zip-functions without a problem.
> Now i
> got and Zip containing an corrupt crc (If i open this file via winzip,
> the
> error is shown).
>
> It looks like the php functions for zip-handeling "zip_entry_read" and
> "ZipArchive::getFrom..." do not quit on a bad crc checksum.... so
> these
> functions read in the file and than are in an infinite loop. Because i
> use
> PHP-GTK2 my tool feezes and the process has to be killed. On an
> web-enviroment this could also a big problem ..... ok, user-zip
> handeling on
> web is not the best idea :-)
>
> I´ve found no way to find out, if an file in the zip file is an valid
> or
> corrupt entry. The output of "ZipArchive::statName" give me no info
> about
> the state of an entry.
>
> Is there any trick out there, how to manage this problem. Maybe this
> is an
> bug or missing feature in the zip extensions. Dont know!


Perhaps checking the consistency with this ZIPARCHIVE::CHECKCONS flag
would help.

This is just a wild guess.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Reply With Quote
  #5 (permalink)  
Old 08-15-2007
ecc
 
Posts: n/a
Default Re: [PHP] zip freezes - how to handle corrupt CRC in zip-file


Ah, fine. How do i use this ZIPARCHIVE::CHECKCONS flag?

Something like that should work, i think?

$zip = new ZipArchive;
$res = $zip->open ( $filename ZIPARCHIVE::CHECKCONS );
if (TRUE === $res) {
# all looks fine
}
elseif {
switch($res){
case ZIPARCHIVE::ER_INCONS:
# do some error handeling
break;
}
# test these errors
# ZIPARCHIVE::ER_EXISTS
# ZIPARCHIVE::ER_INCONS
# ZIPARCHIVE::ER_INVAL
# ZIPARCHIVE::ER_MEMORY
# ZIPARCHIVE::ER_NOENT
# ZIPARCHIVE::ER_NOZIP
# ZIPARCHIVE::ER_OPEN
# ZIPARCHIVE::ER_READ
# ZIPARCHIVE::ER_SEEK
}


Richard Lynch wrote:
>
> On Tue, August 14, 2007 5:42 am, ecc wrote:
>> i´m reading zip-files with the php zip-functions without a problem.
>> Now i
>> got and Zip containing an corrupt crc (If i open this file via winzip,
>> the
>> error is shown).
>>
>> It looks like the php functions for zip-handeling "zip_entry_read" and
>> "ZipArchive::getFrom..." do not quit on a bad crc checksum.... so
>> these
>> functions read in the file and than are in an infinite loop. Because i
>> use
>> PHP-GTK2 my tool feezes and the process has to be killed. On an
>> web-enviroment this could also a big problem ..... ok, user-zip
>> handeling on
>> web is not the best idea :-)
>>
>> I´ve found no way to find out, if an file in the zip file is an valid
>> or
>> corrupt entry. The output of "ZipArchive::statName" give me no info
>> about
>> the state of an entry.
>>
>> Is there any trick out there, how to manage this problem. Maybe this
>> is an
>> bug or missing feature in the zip extensions. Dont know!

>
> Perhaps checking the consistency with this ZIPARCHIVE::CHECKCONS flag
> would help.
>
> This is just a wild guess.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


--
View this message in context: http://www.nabble.com/zip-freezes---...html#a12161999
Sent from the PHP - General mailing list archive at Nabble.com.
Reply With Quote
  #6 (permalink)  
Old 08-16-2007
ecc
 
Posts: n/a
Default Re: [PHP] zip freezes - how to handle corrupt CRC in zip-file


Ok, yesterday i´ve tried this... the command freezese. No chance to get an
error from the archive. Am i stupid? The original zip tool give me an error
on bad crc in a file, php quits with an freeze. I´ve tried also the crc
error. No chance. The $zip->open always give me and TRUE as return value.

If i think, this is an bug, where can i add this?

Regards,
Andreas


ecc wrote:
>
> Ah, fine. How do i use this ZIPARCHIVE::CHECKCONS flag?
>
> Something like that should work, i think?
>
> $zip = new ZipArchive;
> $res = $zip->open ( $filename ZIPARCHIVE::CHECKCONS );
> if (TRUE === $res) {
> # all looks fine
> }
> else {
> switch($res){
> case ZIPARCHIVE::ER_INCONS:
> # do some error handeling
> break;
> }
> # test these errors
> # ZIPARCHIVE::ER_EXISTS
> # ZIPARCHIVE::ER_INCONS
> # ZIPARCHIVE::ER_INVAL
> # ZIPARCHIVE::ER_MEMORY
> # ZIPARCHIVE::ER_NOENT
> # ZIPARCHIVE::ER_NOZIP
> # ZIPARCHIVE::ER_OPEN
> # ZIPARCHIVE::ER_READ
> # ZIPARCHIVE::ER_SEEK
> }
>
>
> Richard Lynch wrote:
>>
>> On Tue, August 14, 2007 5:42 am, ecc wrote:
>>> i´m reading zip-files with the php zip-functions without a problem.
>>> Now i
>>> got and Zip containing an corrupt crc (If i open this file via winzip,
>>> the
>>> error is shown).
>>>
>>> It looks like the php functions for zip-handeling "zip_entry_read" and
>>> "ZipArchive::getFrom..." do not quit on a bad crc checksum.... so
>>> these
>>> functions read in the file and than are in an infinite loop. Because i
>>> use
>>> PHP-GTK2 my tool feezes and the process has to be killed. On an
>>> web-enviroment this could also a big problem ..... ok, user-zip
>>> handeling on
>>> web is not the best idea :-)
>>>
>>> I´ve found no way to find out, if an file in the zip file isan valid
>>> or
>>> corrupt entry. The output of "ZipArchive::statName" give me no info
>>> about
>>> the state of an entry.
>>>
>>> Is there any trick out there, how to manage this problem. Maybe this
>>> is an
>>> bug or missing feature in the zip extensions. Dont know!

>>
>> Perhaps checking the consistency with this ZIPARCHIVE::CHECKCONS flag
>> would help.
>>
>> This is just a wild guess.
>>
>> --
>> Some people have a "gift" link here.
>> Know what I want?
>> I want you to buy a CD from some indie artist.
>> http://cdbaby.com/browse/from/lynch
>> Yeah, I get a buck. So?
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>

>
>


--
View this message in context: http://www.nabble.com/zip-freezes---...html#a12177487
Sent from the PHP - General mailing list archive at Nabble.com.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0