This is an automated email from the ASF dual-hosted git repository.
peterlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new 5e02ee7 COMPRESS-530 : throw IOException instead
5e02ee7 is described below
commit 5e02ee762b8443187b74801e18eddb845fec48db
Author: PeterAlfredLee <[email protected]>
AuthorDate: Wed May 27 21:57:23 2020 +0800
COMPRESS-530 : throw IOException instead
Throw an IOException instead of skipping it if it encounters a non-number
while reading length
in pax header.
---
src/changes/changes.xml | 2 +-
.../apache/commons/compress/archivers/tar/TarArchiveInputStream.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b970000..6eb4141 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -97,7 +97,7 @@ The <action> type attribute can be add,update,fix,remove.
Github Pull Request #102.
</action>
<action issue="COMPRESS-530" type="fix" date="2020-05-26">
- Skip non-number chars while parsing pax headers.
+ Throw IOException when it encounters a non-number while parsing pax
header.
</action>
</release>
<release version="1.20" date="2020-02-08"
diff --git
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 45f6b89..393d0a4 100644
---
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -746,9 +746,9 @@ public class TarArchiveInputStream extends
ArchiveInputStream {
break; // Processed single header
}
- // COMPRESS-530 : skip non-number chars
+ // COMPRESS-530 : throw if we encounter a non-number while
reading length
if (ch < '0' || ch > '9') {
- continue;
+ throw new IOException("Failed to read Paxheader. Encounter
a non-number while reading length");
}
len *= 10;