Repository: commons-compress Updated Branches: refs/heads/master 5def510d0 -> 0ee8f1e8a
COMPRESS-389 only increment loc when anything has been read Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/0ee8f1e8 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/0ee8f1e8 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/0ee8f1e8 Branch: refs/heads/master Commit: 0ee8f1e8ab53746ea9f735aa07e857a0c4e55656 Parents: 5def510 Author: Stefan Bodewig <bode...@apache.org> Authored: Wed Apr 26 06:24:43 2017 +0200 Committer: Stefan Bodewig <bode...@apache.org> Committed: Wed Apr 26 06:24:43 2017 +0200 ---------------------------------------------------------------------- src/changes/changes.xml | 4 ++++ .../java/org/apache/commons/compress/archivers/zip/ZipFile.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/0ee8f1e8/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3b24da7..d40a1a8 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -99,6 +99,10 @@ The <action> type attribute can be add,update,fix,remove. Added a way to limit amount of memory LZMACompressorStream and XZCompressorInputStream may use. </action> + <action issue="COMPRESS-389" type="fix" date="2017-04-26"> + Internal location pointer in ZipFile could get incremented + even if nothing had been read. + </action> </release> <release version="1.13" date="2016-12-29" description="Release 1.13 - API compatible to 1.12 but requires Java 7 at runtime."> http://git-wip-us.apache.org/repos/asf/commons-compress/blob/0ee8f1e8/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java index 0623656..fc7510a 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java @@ -1126,10 +1126,11 @@ public class ZipFile implements Closeable { else { singleByteBuffer.rewind(); } - int read = read(loc++, singleByteBuffer); + int read = read(loc, singleByteBuffer); if (read < 0) { return read; } + loc++; return singleByteBuffer.get() & 0xff; }