You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2011/07/20 17:00:59 UTC

[jira] [Resolved] (COMPRESS-130) ZipArchiveInputStream.skip could use safer comparison; inherited Javadoc is incorrect

     [ https://issues.apache.org/jira/browse/COMPRESS-130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Bodewig resolved COMPRESS-130.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2

The code was heavily inspired by Harmony's and I never looked at the Javadocs, fixed now in svn revision 1148806.

I don't believe skipped could become larger than value, but still made the suggested change.

As a sidenote, our implementation - as Harmony's - breaks InputStream's contract WRT negative arguments.

> ZipArchiveInputStream.skip could use safer comparison; inherited Javadoc is incorrect
> -------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-130
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-130
>             Project: Commons Compress
>          Issue Type: Bug
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 1.2
>
>
> ZipArchiveInputStream.skip uses the condition (skipped != value) to detect when it has skipped enough. 
> It would be safer to use (skipped < value) in case skipped somehow exceeds value.
> Also, the inherited Javadoc says that skip(value) may skip fewer than value bytes - AFAICT this is precisely the potential error that this method was written to solve.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira