mirror of https://github.com/apache/poi.git
Fix issues found when fuzzing Apache POI via Jazzer
Catch and handle a possible NullPointerException in commons-compress We can handle this gracefully for now and can remove this again when commons-compress is fixed, see isse COMPRESS-598 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895598 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3ef9605d29
commit
0210af791e
|
@ -110,7 +110,18 @@ public class ZipArchiveThresholdInputStream extends FilterInputStream {
|
||||||
|
|
||||||
final InputStreamStatistics stats = (InputStreamStatistics)in;
|
final InputStreamStatistics stats = (InputStreamStatistics)in;
|
||||||
final long payloadSize = stats.getUncompressedCount();
|
final long payloadSize = stats.getUncompressedCount();
|
||||||
final long rawSize = stats.getCompressedCount();
|
|
||||||
|
long rawSize;
|
||||||
|
try {
|
||||||
|
rawSize = stats.getCompressedCount();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
// this can happen with a very specially crafted file
|
||||||
|
// see https://issues.apache.org/jira/browse/COMPRESS-598 for a related bug-report
|
||||||
|
// therefore we try to handle this gracefully for now
|
||||||
|
// this try/catch can be removed when COMPRESS-598 is fixed
|
||||||
|
rawSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
final String entryName = entry == null ? "not set" : entry.getName();
|
final String entryName = entry == null ? "not set" : entry.getName();
|
||||||
|
|
||||||
// check the file size first, in case we are working on uncompressed streams
|
// check the file size first, in case we are working on uncompressed streams
|
||||||
|
@ -158,4 +169,4 @@ public class ZipArchiveThresholdInputStream extends FilterInputStream {
|
||||||
void setEntry(ZipArchiveEntry entry) {
|
void setEntry(ZipArchiveEntry entry) {
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue