Skip to content

Commit

Permalink
COMPRESS-567 overlooked a RuntimeException in BoundedArchiveInputStream
Browse files Browse the repository at this point in the history
unfortunately I cannot change the signature of
BoundedArchiveInputStream's constructor as the way it is used in
ZipFile doesn't allow it to throw an IOException without breaking
backwards compatibility of ZipFile#getRawInputStream
  • Loading branch information
bodewig committed May 1, 2021
1 parent 8645883 commit 30ff58d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ private void buildSparseInputStreams() throws IOException {
if (sparseHeader.getNumbytes() > 0) {
final long start =
currEntry.getDataOffset() + sparseHeader.getOffset() - numberOfZeroBytesInSparseEntry;
if (start + sparseHeader.getNumbytes() < start) {
// possible integer overflow
throw new IOException("Unreadable TAR archive, sparse block offset or length too big");
}
streams.add(new BoundedSeekableByteChannelInputStream(start, sparseHeader.getNumbytes(), archive));
}

Expand Down

0 comments on commit 30ff58d

Please sign in to comment.