This is an automated email from the ASF dual-hosted git repository. bodewig pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit de39b85b6d74031fb3a5c269d80be1f1253d1c91 Author: Stefan Bodewig <stefan.bode...@innoq.com> AuthorDate: Fri May 14 17:49:34 2021 +0200 COMPRESS-567 turn possible RuntimeExceptions into IOExceptions Credit to OSS-Fuzz --- .../java/org/apache/commons/compress/archivers/tar/TarFile.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java index 8de9260..1c25ca8 100644 --- a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java @@ -633,8 +633,12 @@ public class TarFile implements Closeable { * @param entry Entry to get the input stream from * @return Input stream of the provided entry */ - public InputStream getInputStream(final TarArchiveEntry entry) { - return new BoundedTarEntryInputStream(entry, archive); + public InputStream getInputStream(final TarArchiveEntry entry) throws IOException { + try { + return new BoundedTarEntryInputStream(entry, archive); + } catch (RuntimeException ex) { + throw new IOException("Corrupted TAR archive. Can't read entry", ex); + } } @Override