Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 13497 invoked from network); 30 Aug 2010 15:31:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Aug 2010 15:31:15 -0000 Received: (qmail 25153 invoked by uid 500); 30 Aug 2010 15:31:15 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 25049 invoked by uid 500); 30 Aug 2010 15:31:14 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 25042 invoked by uid 99); 30 Aug 2010 15:31:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Aug 2010 15:31:14 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Aug 2010 15:31:14 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o7UFUrsV008877 for ; Mon, 30 Aug 2010 15:30:54 GMT Message-ID: <13315643.70371283182253757.JavaMail.jira@thor> Date: Mon, 30 Aug 2010 11:30:53 -0400 (EDT) From: "Roberto Tyley (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-6637) [classlib] [archive] Inflater.inflate() short-circuits on zero-length request, finished() never true for a zero-length data source MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [classlib] [archive] Inflater.inflate() short-circuits on zero-length request, finished() never true for a zero-length data source ---------------------------------------------------------------------------------------------------------------------------------- Key: HARMONY-6637 URL: https://issues.apache.org/jira/browse/HARMONY-6637 Project: Harmony Issue Type: Bug Components: Classlib Reporter: Roberto Tyley Priority: Critical There's code in the inflate() method of classlib/modules/archive/src/main/java/java/util/zip/Inflater.java (r926871 and earlier) which short-cuts the inflation if the parameter 'nbytes' is 0 - ie if the caller is actually requesting zero bytes: if (nbytes == 0) { return 0; --- Don't do any work: DON'T UPDATE THE *FINISHED* FLAG! } While it seems reasonable, it is in fact incompatible with the RI (which *does* attempt to process the deflated source data in the nbytes, and will update the finished() flag) - and so causes problems with a common inflation loop scenario, where the code loops to populate a destination byte-array of known size while inflater.finished() is not true. Even if the destination byte-array is known to be zero-length (e.g. we're deflating a zero-length file), the coder might still reasonably expect calling inflate() to set the finished() flag to true. However, unlike the RI, Harmony implementation does not update the finished() flag, which leads to an infinite loop or some other bad outcome. Bit short on time right now, will try to provide a better testcase and possibly a patch at a later date. best regards, Roberto Tyley -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.