harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6637) [classlib] [archive] Inflater.inflate() short-circuits on zero-length request, finished() never true for a zero-length data source
Date Fri, 01 Oct 2010 13:47:34 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916887#action_12916887
] 

Hudson commented on HARMONY-6637:
---------------------------------

Integrated in Harmony-1.5-head-linux-x86_64 #974 (See [https://hudson.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/974/])
    Apply fix for HARMONY-6637 ([classlib] [archive] Inflater.inflate() short-circuits on
zero-length request, finished() never true for a zero-length data source)


> [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
>            Assignee: Tim Ellison
>            Priority: Critical
>             Fix For: 5.0M16
>
>         Attachments: Main.java
>
>
> 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.


Mime
View raw message