You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2021/12/05 15:34:16 UTC
svn commit: r1895598 - /poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java
Author: centic
Date: Sun Dec 5 15:34:16 2021
New Revision: 1895598
URL: http://svn.apache.org/viewvc?rev=1895598&view=rev
Log:
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
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java?rev=1895598&r1=1895597&r2=1895598&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java Sun Dec 5 15:34:16 2021
@@ -110,7 +110,18 @@ public class ZipArchiveThresholdInputStr
final InputStreamStatistics stats = (InputStreamStatistics)in;
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();
// check the file size first, in case we are working on uncompressed streams
@@ -158,4 +169,4 @@ public class ZipArchiveThresholdInputStr
void setEntry(ZipArchiveEntry entry) {
this.entry = entry;
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org