commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Radu Almășan (JIRA) <j...@apache.org>
Subject [jira] [Updated] (COMPRESS-268) Buffer not read first time for entries with STORED compression method
Date Fri, 28 Feb 2014 22:32:20 GMT

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

Radu Almășan updated COMPRESS-268:
----------------------------------

    Attachment: test.zip

Attached the ZIP file created with Nautilus' context menu, containing just one entry that's
detected with the STORED compression method.

> Buffer not read first time for entries with STORED compression method
> ---------------------------------------------------------------------
>
>                 Key: COMPRESS-268
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-268
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.7
>         Environment: * Fedora 20 x64
> * Java 1.7.0_51 x64
> * archive created with Nautilus' context menu
>            Reporter: Radu Almășan
>              Labels: archive, zip
>         Attachments: test.zip
>
>
> Trying to extract a ZIP archive that contains entries with {{STORED}} compression method,
the {{ZipArchiveInputStream.readStored(byte[], int, int)}} method is called. At this point,
because the {{buf}} array has not had a chance to be populated with values from the underlying
input stream and because there's no condition to detect this, the resulting content is prefixed
with the buffer's length (512) of 0 bytes.
> I've found that chancing:
> bq. if (buf.position() >= buf.limit()) {
> with
> bq. if (buf.position() >= buf.limit() || current.bytesReadFromStream == 0) {
> solves the issue.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message