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] [Created] (COMPRESS-268) Buffer not read first time for entries with STORED compression method
Date Fri, 28 Feb 2014 22:30:19 GMT
Radu Almășan created COMPRESS-268:
-------------------------------------

             Summary: 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
         Environment: * Fedora 20 x64
* Java 1.7.0_51 x64
* archive created with Nautilus' context menu
            Reporter: Radu Almășan


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