turn possible RuntimeExceptions into IOExceptions
Credit to OSS-Fuzz
@@ -633,8 +633,12 @@ private boolean isDirectory() {
* @param entry Entry to get the input stream from
* @return Input stream of the provided entry
*/
- public InputStream getInputStream(final TarArchiveEntry entry) {
+ 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
