You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2016/01/20 18:49:58 UTC
svn commit: r1725765 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java
Author: lehmi
Date: Wed Jan 20 17:49:58 2016
New Revision: 1725765
URL: http://svn.apache.org/viewvc?rev=1725765&view=rev
Log:
PDFBOX-3201: use nowrap mode to bypass zlib-header and checksum to avoid a DataFormatException as proposed by Sumit Saha
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java?rev=1725765&r1=1725764&r2=1725765&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java Wed Jan 20 17:49:58 2016
@@ -116,12 +116,15 @@ public class FlateFilter implements Filt
private void decompress(InputStream in, OutputStream out) throws IOException, DataFormatException
{
byte[] buf = new byte[2048];
+ // skip zlib header
+ in.skip(2);
int read = in.read(buf);
if(read > 0)
{
- Inflater inflater = new Inflater();
+ // use nowrap mode to bypass zlib-header and checksum to avoid a DataFormatException
+ Inflater inflater = new Inflater(true);
inflater.setInput(buf,0,read);
- byte[] res = new byte[32];
+ byte[] res = new byte[1024];
boolean dataWritten = false;
while(true)
{