Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 24280 invoked from network); 11 Feb 2010 15:28:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Feb 2010 15:28:49 -0000 Received: (qmail 77516 invoked by uid 500); 11 Feb 2010 15:28:49 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 77422 invoked by uid 500); 11 Feb 2010 15:28:48 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 77412 invoked by uid 99); 11 Feb 2010 15:28:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Feb 2010 15:28:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Feb 2010 15:28:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F041C29A0014 for ; Thu, 11 Feb 2010 07:28:27 -0800 (PST) Message-ID: <184744026.207761265902107982.JavaMail.jira@brutus.apache.org> Date: Thu, 11 Feb 2010 15:28:27 +0000 (UTC) From: "Stefan Bodewig (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (COMPRESS-96) Corrupt zip files can cause infinite loop In-Reply-To: <1205717143.199001265853149204.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COMPRESS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832520#action_12832520 ] Stefan Bodewig commented on COMPRESS-96: ---------------------------------------- I think this is a duplicate of COMPRESS-87 and has been fixed with svn revision 831204 Could you build commons-compress from trunk and verify that you receive an exception now? At least I can't reproduce the error you describe anymore. > Corrupt zip files can cause infinite loop > ----------------------------------------- > > Key: COMPRESS-96 > URL: https://issues.apache.org/jira/browse/COMPRESS-96 > Project: Commons Compress > Issue Type: Bug > Affects Versions: 1.0 > Environment: OS/X java 1.6 > Reporter: Matthew Bellew > Priority: Critical > > I have a corrupt .zip file (in my Download directory) that causes ZipArchiveInputStream to enter an infinite loop on the second call to getEntry(). This was discovered while testing a Tika/Lucene based search application. Obviously, it would be preferable to detect and throw an exception. The short explanation is that closeEntry() calls skip(Long.MAX_VALUE). skip() calls read() which returns 0 and inf.finished() remains false, so no progress is made and skip() spins. > If it helps, entry.getSize() returns -1 for the first entry. I can provide the file to repro (775800 bytes). > UPDATE: I just hit he same error scanning a truncated commons-compress-1.0-bin.zip (437687 bytes) with this code. > package main; > import org.apache.commons.compress.archivers.ArchiveEntry; > import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream; > import java.io.File; > import java.io.FileInputStream; > import java.io.IOException; > public class Main > { > public static void main(String[] args) throws IOException > { > File f = new File(args[0]); > FileInputStream fis = new FileInputStream(f); > ZipArchiveInputStream zip = new ZipArchiveInputStream(fis); > ArchiveEntry entry; > entry = zip.getNextEntry(); > while (null != entry) > { > if (entry.isDirectory()) > System.out.printf("%s/\n", entry.getName()); > else > System.out.printf("%s %d\n", entry.getName(), entry.getSize()); > entry = zip.getNextEntry(); > } > System.out.print("DONE\n"); > } > } > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.