Bug 56865

Summary: Limit number of bytes (by counting them) while opening office docs
Product: POI Reporter: Christian Schneider <mail>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.11-dev   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Bug Depends on: 50090    
Bug Blocks:    

Description Christian Schneider 2014-08-17 15:54:20 UTC
It would be good to limit the bytes in org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource with a FilterStream that counts the number of bytes up to a defined (configurable) value:

The class org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.FakeZipEntry uses in its constructor the Java class java.util.zip.ZipInputStream for decompressing the office files. Here the instance of this class could be wrapped with another java.io.FilterInputStream that performs the byte counting, as discussed on the private@poi.apache.org mailing list.

Checking just the ZipEntry's entry.getSize() is not enough, since this value can be spoofed.
Comment 1 Andreas Beeker 2015-06-23 23:40:10 UTC
Fixed with r1687148